diff options
| author | Fabien Meghazi <fme@openerp.com> | 2014-02-27 16:49:55 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2014-02-27 16:49:55 +0100 |
| commit | 152e70e9fa5555b57f687d747570f3ff7d6ab769 (patch) | |
| tree | d1fd3ca34bcf32990035ca58627922b98d71f176 /addons/auth_oauth | |
| parent | 6aa24d08968f53d3d30816071c6bc43422ea31fa (diff) | |
| parent | a210c5f5341ccc26530da7f1ac8497d6b9947904 (diff) | |
[IMP] seperation of auth_signup's reset password and signup routes
bzr revid: fme@openerp.com-20140227154955-tnxyzw1ynuwlo5mj
Diffstat (limited to 'addons/auth_oauth')
| -rw-r--r-- | addons/auth_oauth/__openerp__.py | 2 | ||||
| -rw-r--r-- | addons/auth_oauth/controllers/main.py | 24 | ||||
| -rw-r--r-- | addons/auth_oauth/views/auth_oauth_login.xml | 32 |
3 files changed, 50 insertions, 8 deletions
diff --git a/addons/auth_oauth/__openerp__.py b/addons/auth_oauth/__openerp__.py index 76f15687eb9..64068fa9b5e 100644 --- a/addons/auth_oauth/__openerp__.py +++ b/addons/auth_oauth/__openerp__.py @@ -31,7 +31,7 @@ Allow users to login through OAuth2 Provider. 'author': 'OpenERP s.a.', 'maintainer': 'OpenERP s.a.', 'website': 'http://www.openerp.com', - 'depends': ['base', 'web', 'base_setup'], + 'depends': ['base', 'web', 'base_setup', 'auth_signup'], 'data': [ 'res_users.xml', 'auth_oauth_data.xml', diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py index 5a22240abac..7db9479ad13 100644 --- a/addons/auth_oauth/controllers/main.py +++ b/addons/auth_oauth/controllers/main.py @@ -61,10 +61,14 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home): return providers def get_state(self, provider): - return dict( + state = dict( d=request.session.db, p=provider['id'] ) + token = request.params.get('token') + if token: + state['t'] = token + return state @http.route() def web_login(self, *args, **kw): @@ -88,6 +92,24 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home): return response + @http.route() + def web_auth_signup(self, *args, **kw): + providers = self.list_providers() + if len(providers) == 1: + werkzeug.exceptions.abort(werkzeug.utils.redirect(providers[0]['auth_link'], 303)) + response = super(OAuthLogin, self).web_auth_signup(*args, **kw) + response.qcontext.update(providers=providers) + return response + + @http.route() + def web_auth_reset_password(self, *args, **kw): + providers = self.list_providers() + if len(providers) == 1: + werkzeug.exceptions.abort(werkzeug.utils.redirect(providers[0]['auth_link'], 303)) + response = super(OAuthLogin, self).web_auth_reset_password(*args, **kw) + response.qcontext.update(providers=providers) + return response + class OAuthController(http.Controller): @http.route('/auth_oauth/signin', type='http', auth='none') diff --git a/addons/auth_oauth/views/auth_oauth_login.xml b/addons/auth_oauth/views/auth_oauth_login.xml index f969d2f5eed..6c5deca924c 100644 --- a/addons/auth_oauth/views/auth_oauth_login.xml +++ b/addons/auth_oauth/views/auth_oauth_login.xml @@ -3,15 +3,35 @@ --> <openerp> <data> + <template id="auth_oauth.providers" name="OAuth Providers"> + <div t-foreach="providers" t-as="p"> + <a t-att-href="p['auth_link']" class="btn btn-link"> + <i t-att-class="p['css_class']"/> + <t t-esc="p['body']"/> + </a> + </div> + </template> + <template id="auth_oauth.login" inherit_id="web.login" name="OAuth Login buttons"> <xpath expr="//button[@type='submit']" position="before"> <div class="pull-right"> - <div t-foreach="providers" t-as="p"> - <a t-att-href="p['auth_link']" class="btn btn-link"> - <i t-att-class="p['css_class']"/> - <t t-esc="p['body']"/> - </a> - </div> + <t t-call="auth_oauth.providers"/> + </div> + </xpath> + </template> + + <template id="auth_oauth.signup" inherit_id="auth_signup.signup" name="OAuth Signup buttons"> + <xpath expr="//button[@type='submit']" position="before"> + <div class="pull-right"> + <t t-call="auth_oauth.providers"/> + </div> + </xpath> + </template> + + <template id="auth_oauth.reset_password" inherit_id="auth_signup.reset_password" name="OAuth Reset Password buttons"> + <xpath expr="//button[@type='submit']" position="before"> + <div class="pull-right"> + <t t-call="auth_oauth.providers"/> </div> </xpath> </template> |
