Raphael Collet (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-merge_signup_resetpw-rco into lp:openobject-addons.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-merge_signup_resetpw-rco/+merge/137617 - merge module auth_reset_password into auth_signup (implementation is provided by the latter, anyway); - improve the res.users form (hide password field); - automatically invite new users to set their password; - control visibility of links 'Sign Up' and 'Reset Password' on login page. -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-merge_signup_resetpw-rco/+merge/137617 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-merge_signup_resetpw-rco.
=== removed directory 'auth_reset_password' === removed file 'auth_reset_password/__init__.py' --- auth_reset_password/__init__.py 2012-10-03 13:21:52 +0000 +++ auth_reset_password/__init__.py 1970-01-01 00:00:00 +0000 @@ -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 === removed file 'auth_reset_password/__openerp__.py' --- auth_reset_password/__openerp__.py 2012-11-30 10:05:16 +0000 +++ auth_reset_password/__openerp__.py 1970-01-01 00:00:00 +0000 @@ -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'], -} === removed file 'auth_reset_password/auth_reset_password.xml' --- auth_reset_password/auth_reset_password.xml 2012-10-01 15:07:23 +0000 +++ auth_reset_password/auth_reset_password.xml 1970-01-01 00:00:00 +0000 @@ -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> === removed directory 'auth_reset_password/controllers' === removed file 'auth_reset_password/controllers/__init__.py' --- auth_reset_password/controllers/__init__.py 2012-10-01 15:07:23 +0000 +++ auth_reset_password/controllers/__init__.py 1970-01-01 00:00:00 +0000 @@ -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: === removed file 'auth_reset_password/controllers/main.py' --- auth_reset_password/controllers/main.py 2012-10-10 20:46:17 +0000 +++ auth_reset_password/controllers/main.py 1970-01-01 00:00:00 +0000 @@ -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: === removed directory 'auth_reset_password/i18n' === removed file 'auth_reset_password/i18n/ar.po' --- auth_reset_password/i18n/ar.po 2012-12-02 04:38:59 +0000 +++ auth_reset_password/i18n/ar.po 1970-01-01 00:00:00 +0000 @@ -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 <[email protected]>\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 "" === removed file 'auth_reset_password/i18n/auth_reset_password.pot' --- auth_reset_password/i18n/auth_reset_password.pot 2012-11-24 03:08:04 +0000 +++ auth_reset_password/i18n/auth_reset_password.pot 1970-01-01 00:00:00 +0000 @@ -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 "" - === removed file 'auth_reset_password/i18n/it.po' --- auth_reset_password/i18n/it.po 2012-11-29 05:15:32 +0000 +++ auth_reset_password/i18n/it.po 1970-01-01 00:00:00 +0000 @@ -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 <[email protected]>\n" -"Language-Team: Italian <[email protected]>\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" === removed file 'auth_reset_password/i18n/nl.po' --- auth_reset_password/i18n/nl.po 2012-11-30 05:08:27 +0000 +++ auth_reset_password/i18n/nl.po 1970-01-01 00:00:00 +0000 @@ -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 <[email protected]>\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" === removed file 'auth_reset_password/i18n/ru.po' --- auth_reset_password/i18n/ru.po 2012-12-01 05:09:10 +0000 +++ auth_reset_password/i18n/ru.po 1970-01-01 00:00:00 +0000 @@ -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 <[email protected]>\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 "" === removed file 'auth_reset_password/i18n/tr.po' --- auth_reset_password/i18n/tr.po 2012-11-28 04:41:50 +0000 +++ auth_reset_password/i18n/tr.po 1970-01-01 00:00:00 +0000 @@ -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 <[email protected]>\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" === removed file 'auth_reset_password/i18n/zh_CN.po' --- auth_reset_password/i18n/zh_CN.po 2012-11-29 05:15:32 +0000 +++ auth_reset_password/i18n/zh_CN.po 1970-01-01 00:00:00 +0000 @@ -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 <[email protected]>\n" -"Language-Team: Chinese (Simplified) <[email protected]>\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 "重设密码" === removed file 'auth_reset_password/res_users.py' --- auth_reset_password/res_users.py 2012-11-28 10:55:20 +0000 +++ auth_reset_password/res_users.py 1970-01-01 00:00:00 +0000 @@ -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 === removed file 'auth_reset_password/res_users_view.xml' --- auth_reset_password/res_users_view.xml 2012-11-28 09:12:31 +0000 +++ auth_reset_password/res_users_view.xml 1970-01-01 00:00:00 +0000 @@ -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> === removed directory 'auth_reset_password/static' === removed directory 'auth_reset_password/static/src' === removed directory 'auth_reset_password/static/src/js' === removed file 'auth_reset_password/static/src/js/reset_password.js' --- auth_reset_password/static/src/js/reset_password.js 2012-10-01 15:07:23 +0000 +++ auth_reset_password/static/src/js/reset_password.js 1970-01-01 00:00:00 +0000 @@ -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; - } - }); -}; === removed directory 'auth_reset_password/static/src/xml' === removed file 'auth_reset_password/static/src/xml/reset_password.xml' --- auth_reset_password/static/src/xml/reset_password.xml 2012-10-01 15:07:23 +0000 +++ auth_reset_password/static/src/xml/reset_password.xml 1970-01-01 00:00:00 +0000 @@ -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> === modified file 'auth_signup/__openerp__.py' --- auth_signup/__openerp__.py 2012-11-28 00:14:49 +0000 +++ auth_signup/__openerp__.py 2012-12-03 16:12:31 +0000 @@ -22,15 +22,18 @@ { 'name': 'Signup', 'description': """ -Allow users to sign up. -======================= +Allow users to sign up and reset their password +=============================================== """, 'author': 'OpenERP SA', 'version': '1.0', 'category': 'Authentication', 'website': 'http://www.openerp.com', 'installable': True, - 'depends': ['base_setup'], + 'depends': [ + 'base_setup', + 'email_template', + ], 'data': [ 'auth_signup_data.xml', 'res_config.xml', === modified file 'auth_signup/auth_signup_data.xml' --- auth_signup/auth_signup_data.xml 2012-09-20 07:48:50 +0000 +++ auth_signup/auth_signup_data.xml 2012-12-03 16:12:31 +0000 @@ -18,5 +18,20 @@ <field name="value" ref="default_template_user"/> </record> + <!-- 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 by following <a href="${object.signup_url}">this link</a>.</p> + +<p>Note: If you do not expect this, you can safely ignore this email.</p>]]></field> + </record> + </data> </openerp> === modified file 'auth_signup/controllers/main.py' --- auth_signup/controllers/main.py 2012-11-23 16:00:48 +0000 +++ auth_signup/controllers/main.py 2012-12-03 16:12:31 +0000 @@ -19,10 +19,12 @@ # ############################################################################## import logging +import urllib + +import werkzeug import openerp from openerp.modules.registry import RegistryManager - from ..res_users import SignupError _logger = logging.getLogger(__name__) @@ -31,6 +33,18 @@ _cp_path = '/auth_signup' @openerp.addons.web.http.jsonrequest + def get_config(self, req, dbname): + """ retrieve the module config (which features are enabled) for the login page """ + registry = RegistryManager.get(dbname) + with registry.cursor() as cr: + icp = registry.get('ir.config_parameter') + config = { + 'signup': icp.get_param(cr, openerp.SUPERUSER_ID, 'auth_signup.allow_uninvited') == 'True', + 'reset_password': icp.get_param(cr, openerp.SUPERUSER_ID, 'auth_signup.reset_password') == 'True', + } + return config + + @openerp.addons.web.http.jsonrequest def retrieve(self, req, dbname, token): """ retrieve the user info (name, login or email) corresponding to a signup token """ registry = RegistryManager.get(dbname) @@ -56,4 +70,21 @@ cr.commit() return {} + @openerp.addons.web.http.httprequest + def reset_password(self, req, dbname, login): + """ retrieve user, and perform reset password """ + registry = RegistryManager.get(dbname) + with registry.cursor() as cr: + try: + res_users = registry.get('res.users') + res_users.reset_password(cr, openerp.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 + params = [('action', 'login'), ('error_message', message)] + return werkzeug.utils.redirect("/#" + urllib.urlencode(params)) + # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'auth_signup/res_config.py' --- auth_signup/res_config.py 2012-10-03 08:38:31 +0000 +++ auth_signup/res_config.py 2012-12-03 16:12:31 +0000 @@ -26,14 +26,19 @@ _inherit = 'base.config.settings' _columns = { - 'auth_signup_uninvited': fields.boolean('Allow external users to sign up', help="If unchecked, only invited users may sign up"), - 'auth_signup_template_user_id': fields.many2one('res.users', 'Template user for new users created through signup'), + 'auth_signup_reset_password': fields.boolean('Enable password reset from Login page', + help="This allows users to trigger a password reset from the Login page."), + 'auth_signup_uninvited': fields.boolean('Allow external users to sign up', + help="If unchecked, only invited users may sign up."), + 'auth_signup_template_user_id': fields.many2one('res.users', + string='Template user for new users created through signup'), } def get_default_auth_signup_template_user_id(self, cr, uid, fields, context=None): icp = self.pool.get('ir.config_parameter') # we use safe_eval on the result, since the value of the parameter is a nonempty string return { + 'auth_signup_reset_password': safe_eval(icp.get_param(cr, uid, 'auth_signup.reset_password', 'False')), 'auth_signup_uninvited': safe_eval(icp.get_param(cr, uid, 'auth_signup.allow_uninvited', 'False')), 'auth_signup_template_user_id': safe_eval(icp.get_param(cr, uid, 'auth_signup.template_user_id', 'False')), } @@ -42,5 +47,6 @@ config = self.browse(cr, uid, ids[0], context=context) icp = self.pool.get('ir.config_parameter') # we store the repr of the values, since the value of the parameter is a required string + icp.set_param(cr, uid, 'auth_signup.reset_password', repr(config.auth_signup_reset_password)) icp.set_param(cr, uid, 'auth_signup.allow_uninvited', repr(config.auth_signup_uninvited)) icp.set_param(cr, uid, 'auth_signup.template_user_id', repr(config.auth_signup_template_user_id.id)) === modified file 'auth_signup/res_config.xml' --- auth_signup/res_config.xml 2012-09-21 10:42:37 +0000 +++ auth_signup/res_config.xml 2012-12-03 16:12:31 +0000 @@ -9,6 +9,10 @@ <field name="arch" type="xml"> <xpath expr="//field[@name='module_auth_anonymous']/.." position="after"> <div> + <field name="auth_signup_reset_password" class="oe_inline"/> + <label for="auth_signup_reset_password"/> + </div> + <div> <field name="auth_signup_uninvited" class="oe_inline"/> <label for="auth_signup_uninvited"/> </div> === modified file 'auth_signup/res_users.py' --- auth_signup/res_users.py 2012-11-28 09:03:35 +0000 +++ auth_signup/res_users.py 2012-12-03 16:12:31 +0000 @@ -18,14 +18,15 @@ # along with this program. If not, see <http://www.gnu.org/licenses/> # ############################################################################## +from datetime import datetime, timedelta import random -import time import urllib import urlparse from openerp.osv import osv, fields from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools.safe_eval import safe_eval +from openerp.tools.translate import _ class SignupError(Exception): pass @@ -33,10 +34,12 @@ def random_token(): # the token has an entropy of about 120 bits (6 bits/char * 20 chars) chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' - return ''.join(random.choice(chars) for _ in xrange(20)) - -def now(): - return time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + return ''.join(random.choice(chars) for i in xrange(20)) + +def now(**kwargs): + dt = datetime.now() + timedelta(**kwargs) + return dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT) + class res_partner(osv.Model): _inherit = 'res.partner' @@ -58,7 +61,7 @@ # when required, make sure the partner has a valid signup token if context and context.get('signup_valid') and not partner.user_ids: self.signup_prepare(cr, uid, [partner.id], context=context) - + action_template = None params = { 'action': urllib.quote(action), @@ -218,3 +221,39 @@ # create a copy of the template user (attached to a specific partner_id if given) values['active'] = True return self.copy(cr, uid, template_user_id, values, context=context) + + 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_signup', '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 + + def create(self, cr, uid, values, context=None): + # overridden to automatically invite user to sign up + user_id = super(res_users, self).create(cr, uid, values, context=context) + user = self.browse(cr, uid, user_id, context=context) + if user.email: + user.action_reset_password() + return user_id === modified file 'auth_signup/res_users_view.xml' --- auth_signup/res_users_view.xml 2012-10-02 14:57:57 +0000 +++ auth_signup/res_users_view.xml 2012-12-03 16:12:31 +0000 @@ -7,11 +7,23 @@ <field name="model">res.users</field> <field name="inherit_id" ref="base.view_users_form"/> <field name="arch" type="xml"> + <!-- add state field in header --> <xpath expr="//sheet" position="before"> <header> <field name="state" widget="statusbar"/> </header> </xpath> + <!-- add 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 an email to the user to (re)set their password."/> + </div> + </xpath> + <!-- hide field set_password --> + <field name="new_password" position="replace"> + <field name="new_password" groups="base.group_no_one"/> + </field> </field> </record> === modified file 'auth_signup/static/src/js/auth_signup.js' --- auth_signup/static/src/js/auth_signup.js 2012-11-29 10:40:39 +0000 +++ auth_signup/static/src/js/auth_signup.js 2012-12-03 16:12:31 +0000 @@ -43,8 +43,28 @@ .fail(self.on_token_failed) }); } + + // bind reset password link + this.$('a.oe_signup_reset_password').click(this.do_reset_password); + + // make signup link and reset password link visible only when enabled + this.$('a.oe_signup_signup').hide(); + this.$('a.oe_signup_reset_password').hide(); + if (this.params.db) { + this.rpc("/auth_signup/get_config", {dbname: self.params.db}) + .done(function(result) { + if (result.signup) { + self.$('a.oe_signup_signup').show(); + } + if (result.reset_password) { + self.$('a.oe_signup_reset_password').show(); + } + }); + } + return d; }, + on_token_loaded: function(result) { // select the right the database this.selected_db = result.db; @@ -66,6 +86,7 @@ this.$("form input[name=login]").val(result.login || ""); } }, + on_token_failed: function(result, ev) { if (ev) { ev.preventDefault(); @@ -74,6 +95,7 @@ delete this.params.db; delete this.params.token; }, + on_submit: function(ev) { if (ev) { ev.preventDefault(); @@ -124,6 +146,26 @@ this._super(ev); } }, + + 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_signup/reset_password?" + $.param(params); + window.location = url; + }, }); - }; === modified file 'auth_signup/static/src/xml/auth_signup.xml' --- auth_signup/static/src/xml/auth_signup.xml 2012-11-28 00:14:49 +0000 +++ auth_signup/static/src/xml/auth_signup.xml 2012-12-03 16:12:31 +0000 @@ -22,6 +22,7 @@ <button class="oe_signup_show" name="submit">Sign up</button> <a class="oe_signup_hide oe_signup_signup" href="#">Sign Up</a> <a class="oe_signup_show oe_signup_back" href="#">Back to Login</a> + <a class="oe_signup_reset_password" href="#">Reset password</a> </li> </t> </t>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp

