[REM] auth_reset_password: functionality is taken over by auth_signup

bzr revid: rco@openerp.com-20121203155005-cl6pu8dj9joagata
This commit is contained in:
Raphael Collet 2012-12-03 16:50:05 +01:00
parent 4d200952f7
commit 1ea7171ae9
16 changed files with 0 additions and 817 deletions

View File

@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
import controllers
import res_users

View File

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
{
'name': 'Reset Password',
'description': """
Reset Password
==============
Allow users to reset their password from the login page.
Allow administrator to click a button to send a "Reset Password" request to a user.
""",
'author': 'OpenERP SA',
'version': '1.0',
'category': 'Authentication',
'website': 'http://www.openerp.com',
'installable': True,
'depends': ['auth_signup', 'email_template'],
'data': [
'auth_reset_password.xml',
'res_users_view.xml',
],
'js': ['static/src/js/reset_password.js'],
'qweb': ['static/src/xml/reset_password.xml'],
}

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- Email template for reset password -->
<record id="reset_password_email" model="email.template">
<field name="name">Reset Password</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="email_from"><![CDATA[${object.company_id.name} <${object.company_id.email}>]]></field>
<field name="email_to">${object.email}</field>
<field name="subject">Password reset</field>
<field name="body_html"><![CDATA[
<p>A password reset was requested for the OpenERP account linked to this email.</p>
<p>You may change your password following <a href="${object.signup_url}">this link</a>.</p>
<p>Note: If you did not ask for a password reset, you can safely ignore this email.</p>]]></field>
</record>
</data>
</openerp>

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
import main
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,52 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
import logging
import werkzeug
import openerp
from openerp import SUPERUSER_ID
from openerp.modules.registry import RegistryManager
_logger = logging.getLogger(__name__)
class Controller(openerp.addons.web.http.Controller):
_cp_path = '/auth_reset_password'
@openerp.addons.web.http.httprequest
def reset_password(self, req, dbname, login):
""" retrieve user, and perform reset password """
url = '/'
registry = RegistryManager.get(dbname)
with registry.cursor() as cr:
try:
res_users = registry.get('res.users')
res_users.reset_password(cr, SUPERUSER_ID, login)
cr.commit()
message = 'An email has been sent with credentials to reset your password'
except Exception as e:
# signup error
_logger.exception('error when resetting password')
message = e.message
url = "/#action=login&error_message=%s" % werkzeug.urls.url_quote(message)
return werkzeug.utils.redirect(url)
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,74 +0,0 @@
# Arabic translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-12-01 10:40+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Arabic <ar@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-12-02 04:38+0000\n"
"X-Generator: Launchpad (build 16319)\n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid ""
"\n"
"<p>A password reset was requested for the OpenERP account linked to this "
"email.</p>\n"
"\n"
"<p>You may change your password following <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this "
"email.</p>"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr ""
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr ""
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr ""
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr ""
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr ""
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr ""
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr ""

View File

@ -1,69 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * auth_reset_password
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0alpha\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-11-24 02:52+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid "\n"
"<p>A password reset was requested for the OpenERP account linked to this email.</p>\n"
"\n"
"<p>You may change your password following <a href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this email.</p>"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr ""
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr ""
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr ""
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr ""
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr ""
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr ""
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr ""

View File

@ -1,74 +0,0 @@
# Italian translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-11-28 19:58+0000\n"
"Last-Translator: Davide Corio - agilebg.com <davide.corio@agilebg.com>\n"
"Language-Team: Italian <it@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-11-29 05:15+0000\n"
"X-Generator: Launchpad (build 16319)\n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid ""
"\n"
"<p>A password reset was requested for the OpenERP account linked to this "
"email.</p>\n"
"\n"
"<p>You may change your password following <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this "
"email.</p>"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr "Non è possibile avere due utenti con lo stesso login!"
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr "Utenti"
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr "il UID OAuth deve essere unico per provider"
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr "Reimposta Password"
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr "Ripristino password"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr "Errore: codice EAN non valido"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr "L'azienda scelta non è fra le aziende abilitate per questo utente"
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr "Reimposta password"

View File

@ -1,74 +0,0 @@
# Dutch translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-11-29 15:12+0000\n"
"Last-Translator: Erwin van der Ploeg (Endian Solutions) <Unknown>\n"
"Language-Team: Dutch <nl@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-11-30 05:08+0000\n"
"X-Generator: Launchpad (build 16319)\n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid ""
"\n"
"<p>A password reset was requested for the OpenERP account linked to this "
"email.</p>\n"
"\n"
"<p>You may change your password following <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this "
"email.</p>"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr "U kunt niet twee gebruikers hebben met dezelfde gebruikersnaam !"
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr "Gebruikers"
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr "OAuth UID moet uniek zijn per provider"
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr "Stel wachtwoord opnieuw in"
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr "Reset wachtwoord"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr "Fout: Ongeldige EAN-code"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr "Het gekozen bedrijf is geen toegestaan bedrijf voor deze gebruiker"
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr "Reset wachtwoord"

View File

@ -1,74 +0,0 @@
# Russian translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-11-30 19:40+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Russian <ru@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-12-01 05:09+0000\n"
"X-Generator: Launchpad (build 16319)\n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid ""
"\n"
"<p>A password reset was requested for the OpenERP account linked to this "
"email.</p>\n"
"\n"
"<p>You may change your password following <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this "
"email.</p>"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr ""
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr ""
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr ""
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr ""
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr ""
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr ""
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr ""
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr ""

View File

@ -1,83 +0,0 @@
# Turkish translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-11-27 22:15+0000\n"
"Last-Translator: Ahmet Altınışık <Unknown>\n"
"Language-Team: Turkish <tr@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-11-28 04:41+0000\n"
"X-Generator: Launchpad (build 16309)\n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid ""
"\n"
"<p>A password reset was requested for the OpenERP account linked to this "
"email.</p>\n"
"\n"
"<p>You may change your password following <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this "
"email.</p>"
msgstr ""
"\n"
"<p>Bu epostayla ilişkili OpenERP hesabı için bir parola sıfırlama isteği "
"istendi.</p>\n"
"\n"
"<p>Şifrenizi şu adresten değiştirebilirsiniz. <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Not: Eğer bu parola değiştirme isteğini siz yapmadıysanız bu mesajı "
"görmezden gelebilirsiniz. </p>"
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr "Aynı kullanıcı adı ile iki kullanıcı oluşturamazsınız !"
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr "Kullanıcılar"
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr "OAuth UID her sağlayıcı için tekil olmalı"
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr "Parolayı Sıfırla"
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr "Parola sıfırlandı"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr "Hata: Geçersiz EAN barkodu"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr "Seçilen şirket bu kullanıcı için izin verilen şirketler arasında yok"
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr "Parolayı sıfırla"

View File

@ -1,78 +0,0 @@
# Chinese (Simplified) translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-11-24 02:52+0000\n"
"PO-Revision-Date: 2012-11-28 07:14+0000\n"
"Last-Translator: ccdos <ccdos@163.com>\n"
"Language-Team: Chinese (Simplified) <zh_CN@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-11-29 05:15+0000\n"
"X-Generator: Launchpad (build 16319)\n"
#. module: auth_reset_password
#: model:email.template,body_html:auth_reset_password.reset_password_email
msgid ""
"\n"
"<p>A password reset was requested for the OpenERP account linked to this "
"email.</p>\n"
"\n"
"<p>You may change your password following <a "
"href=\"${object.signup_url}\">this link</a>.</p>\n"
"\n"
"<p>Note: If you did not ask for a password reset, you can safely ignore this "
"email.</p>"
msgstr ""
"\n"
"一个关联到这个Email地址的Openerp帐号请求复位密码。\n"
"你可以修改你的密码通过下面这个链接 <a href=\"${object.signup_url}\">。\n"
"提醒:如果你没请求复位密码,请忽略这封邮件。"
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "You can not have two users with the same login !"
msgstr "两个用户不能使用相同的用户名!"
#. module: auth_reset_password
#: model:ir.model,name:auth_reset_password.model_res_users
msgid "Users"
msgstr "用户"
#. module: auth_reset_password
#: sql_constraint:res.users:0
msgid "OAuth UID must be unique per provider"
msgstr "OAuth UID必须是每个提供者唯一的"
#. module: auth_reset_password
#: view:res.users:0
msgid "Reset Password"
msgstr "重置密码"
#. module: auth_reset_password
#: model:email.template,subject:auth_reset_password.reset_password_email
msgid "Password reset"
msgstr "重置密码"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "Error: Invalid ean code"
msgstr "错误:无效的(EAN)条码"
#. module: auth_reset_password
#: constraint:res.users:0
msgid "The chosen company is not in the allowed companies for this user"
msgstr "选择的公司不属于此用户允许访问的公司。"
#. module: auth_reset_password
#. openerp-web
#: code:addons/auth_reset_password/static/src/xml/reset_password.xml:7
#, python-format
msgid "Reset password"
msgstr "重设密码"

View File

@ -1,62 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
from openerp.osv import osv, fields
from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.translate import _
from datetime import datetime, timedelta
def now(**kwargs):
dt = datetime.now() + timedelta(**kwargs)
return dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
class res_users(osv.osv):
_inherit = 'res.users'
def reset_password(self, cr, uid, login, context=None):
""" retrieve the user corresponding to login (login or email),
and reset their password
"""
user_ids = self.search(cr, uid, [('login', '=', login)], context=context)
if not user_ids:
user_ids = self.search(cr, uid, [('email', '=', login)], context=context)
if len(user_ids) != 1:
raise Exception('Reset password: invalid username or email')
return self.action_reset_password(cr, uid, user_ids, context=context)
def action_reset_password(self, cr, uid, ids, context=None):
""" create signup token for each user, and send their signup url by email """
# prepare reset password signup
res_partner = self.pool.get('res.partner')
partner_ids = [user.partner_id.id for user in self.browse(cr, uid, ids, context)]
res_partner.signup_prepare(cr, uid, partner_ids, expiration=now(days=+1), context=context)
# send email to users with their signup url
template = self.pool.get('ir.model.data').get_object(cr, uid, 'auth_reset_password', 'reset_password_email')
assert template._name == 'email.template'
for user in self.browse(cr, uid, ids, context):
if not user.email:
raise osv.except_osv(_("Cannot send email: user has no email address."), user.name)
self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, context=context)
return True

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="res_users_form_view" model="ir.ui.view">
<field name="name">user.form.reset_password</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<!-- Reset Password button -->
<xpath expr="//sheet/*[1]" position="before">
<div class="oe_right oe_button_box">
<button string="Reset Password" type="object" name="action_reset_password"
help="Send a special url by email to make the user (re)set their password."/>
</div>
</xpath>
<!-- password is never required; one can use Reset Password -->
<field name="new_password" position="attributes">
<attribute name="attrs">{}</attribute>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -1,30 +0,0 @@
openerp.auth_reset_password = function(instance) {
var _t = instance.web._t;
instance.web.Login.include({
start: function() {
this.$('a.oe_reset_password').click(this.do_reset_password);
return this._super();
},
do_reset_password: function(ev) {
if (ev) {
ev.preventDefault();
}
var db = this.$("form [name=db]").val();
var login = this.$("form input[name=login]").val();
if (!db) {
this.do_warn("Login", "No database selected !");
return false;
} else if (!login) {
this.do_warn("Login", "Please enter a username or email address.")
return false;
}
var params = {
dbname : db,
login: login,
};
var url = "/auth_reset_password/reset_password?" + $.param(params);
window.location = url;
}
});
};

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim:fdl=1: -->
<templates id="template" xml:space="preserve">
<t t-extend="Login">
<t t-jquery="form ul:first li:last" t-operation="after">
<li><a class="oe_reset_password" href="#">Reset password</a></li>
</t>
</t>
</templates>