From f3bd6b3baf9e569d96dfba0b490c79a152f90ec1 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 11 Jun 2013 18:59:47 +0200 Subject: Added @nodb where it is required bzr revid: nicolas.vanhoren@openerp.com-20130611165947-36997uizrxtnore0 --- addons/auth_signup/controllers/main.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addons/auth_signup/controllers/main.py') diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 924e1546862..047e5e38e12 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -23,6 +23,7 @@ import logging import openerp from openerp.modules.registry import RegistryManager from ..res_users import SignupError +from openerp.addons.web.http import nodb, noauth _logger = logging.getLogger(__name__) @@ -30,6 +31,7 @@ class Controller(openerp.addons.web.http.Controller): _cp_path = '/auth_signup' @openerp.addons.web.http.jsonrequest + @nodb def get_config(self, req, dbname): """ retrieve the module config (which features are enabled) for the login page """ registry = RegistryManager.get(dbname) -- cgit v1.2.3 From 56f2e7631fbfed05a8153ef2be54d966e7cc389c Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 20 Jun 2013 12:01:22 +0200 Subject: Some more refactoring to use @route() bzr revid: nicolas.vanhoren@openerp.com-20130620100122-3mtvqr1w5yrikitk --- addons/auth_signup/controllers/main.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'addons/auth_signup/controllers/main.py') diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 047e5e38e12..e1e1fa5851a 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -23,16 +23,15 @@ import logging import openerp from openerp.modules.registry import RegistryManager from ..res_users import SignupError -from openerp.addons.web.http import nodb, noauth +import openerp.addons.web.http as http +from openerp.addons.web.http import request _logger = logging.getLogger(__name__) -class Controller(openerp.addons.web.http.Controller): - _cp_path = '/auth_signup' +class Controller(http.Controller): - @openerp.addons.web.http.jsonrequest - @nodb - def get_config(self, req, dbname): + @http.route('/auth_signup/get_config', type='json', authentication="nodb") + def get_config(self, dbname): """ retrieve the module config (which features are enabled) for the login page """ registry = RegistryManager.get(dbname) with registry.cursor() as cr: @@ -43,8 +42,8 @@ class Controller(openerp.addons.web.http.Controller): } return config - @openerp.addons.web.http.jsonrequest - def retrieve(self, req, dbname, token): + @http.route('/auth_signup/retrieve', type='json', authentication="auth") + def retrieve(self, dbname, token): """ retrieve the user info (name, login or email) corresponding to a signup token """ registry = RegistryManager.get(dbname) with registry.cursor() as cr: @@ -52,23 +51,23 @@ class Controller(openerp.addons.web.http.Controller): user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token) return user_info - @openerp.addons.web.http.jsonrequest - def signup(self, req, dbname, token, **values): + @http.route('/auth_signup/signup', type='json', authentication="auth") + def signup(self, dbname, token, **values): """ sign up a user (new or existing)""" try: - self._signup_with_values(req, dbname, token, values) + self._signup_with_values(dbname, token, values) except SignupError, e: return {'error': openerp.tools.exception_to_unicode(e)} return {} - def _signup_with_values(self, req, dbname, token, values): + def _signup_with_values(self, dbname, token, values): registry = RegistryManager.get(dbname) with registry.cursor() as cr: res_users = registry.get('res.users') res_users.signup(cr, openerp.SUPERUSER_ID, values, token) - @openerp.addons.web.http.jsonrequest - def reset_password(self, req, dbname, login): + @http.route('/auth_signup/reset_password', type='json', authentication="auth") + def reset_password(self, dbname, login): """ retrieve user, and perform reset password """ registry = RegistryManager.get(dbname) with registry.cursor() as cr: -- cgit v1.2.3 From a574ce71bf5a479f7ce7ebb825dc4338768681ca Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 21 Jun 2013 14:45:34 +0200 Subject: Small refactoring bzr revid: nicolas.vanhoren@openerp.com-20130621124534-bvsjihld3j9vqpkw --- addons/auth_signup/controllers/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/auth_signup/controllers/main.py') diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index e1e1fa5851a..8c61af1f03c 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -30,7 +30,7 @@ _logger = logging.getLogger(__name__) class Controller(http.Controller): - @http.route('/auth_signup/get_config', type='json', authentication="nodb") + @http.route('/auth_signup/get_config', type='json', auth="none") def get_config(self, dbname): """ retrieve the module config (which features are enabled) for the login page """ registry = RegistryManager.get(dbname) @@ -42,7 +42,7 @@ class Controller(http.Controller): } return config - @http.route('/auth_signup/retrieve', type='json', authentication="auth") + @http.route('/auth_signup/retrieve', type='json', auth="user") def retrieve(self, dbname, token): """ retrieve the user info (name, login or email) corresponding to a signup token """ registry = RegistryManager.get(dbname) @@ -51,7 +51,7 @@ class Controller(http.Controller): user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token) return user_info - @http.route('/auth_signup/signup', type='json', authentication="auth") + @http.route('/auth_signup/signup', type='json', auth="user") def signup(self, dbname, token, **values): """ sign up a user (new or existing)""" try: @@ -66,7 +66,7 @@ class Controller(http.Controller): res_users = registry.get('res.users') res_users.signup(cr, openerp.SUPERUSER_ID, values, token) - @http.route('/auth_signup/reset_password', type='json', authentication="auth") + @http.route('/auth_signup/reset_password', type='json', auth="user") def reset_password(self, dbname, login): """ retrieve user, and perform reset password """ registry = RegistryManager.get(dbname) -- cgit v1.2.3 From 3e8f06ad06644584ec7a868f691038a8abf389d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 3 Jul 2013 15:49:53 +0200 Subject: [FIX] auth_signup: refactoring to new framework introduced an authentification level to user for login; none seems to be required because the user is not authentified anymore. bzr revid: tde@openerp.com-20130703134953-ltdsi9m409mrev2c --- addons/auth_signup/controllers/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/auth_signup/controllers/main.py') diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 8c61af1f03c..e42dc64151f 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -42,7 +42,7 @@ class Controller(http.Controller): } return config - @http.route('/auth_signup/retrieve', type='json', auth="user") + @http.route('/auth_signup/retrieve', type='json', auth="none") def retrieve(self, dbname, token): """ retrieve the user info (name, login or email) corresponding to a signup token """ registry = RegistryManager.get(dbname) @@ -51,7 +51,7 @@ class Controller(http.Controller): user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token) return user_info - @http.route('/auth_signup/signup', type='json', auth="user") + @http.route('/auth_signup/signup', type='json', auth="none") def signup(self, dbname, token, **values): """ sign up a user (new or existing)""" try: @@ -66,7 +66,7 @@ class Controller(http.Controller): res_users = registry.get('res.users') res_users.signup(cr, openerp.SUPERUSER_ID, values, token) - @http.route('/auth_signup/reset_password', type='json', auth="user") + @http.route('/auth_signup/reset_password', type='json', auth="none") def reset_password(self, dbname, login): """ retrieve user, and perform reset password """ registry = RegistryManager.get(dbname) -- cgit v1.2.3