Exemple #1
0
 def web_login(self, *args, **kw):
     ensure_db()
     response = super(AuthSignupHome, self).web_login(*args, **kw)
     response.qcontext.update(self.get_auth_signup_config())
     if request.httprequest.method == 'GET' and request.session.uid and request.params.get('redirect'):
         # Redirect if already logged in and redirect param is present
         return http.redirect_with_hash(request.params.get('redirect'))
     return response
Exemple #2
0
 def web_login(self, redirect=None, *args, **kw):
     response = super(Website, self).web_login(redirect=redirect, *args, **kw)
     if not redirect and request.params['login_success']:
         if request.env['res.users'].browse(request.uid).has_group('base.group_user'):
             redirect = '/web?' + request.httprequest.query_string
         else:
             redirect = '/'
         return http.redirect_with_hash(redirect)
     return response
Exemple #3
0
    def web_login(self, *args, **kw):
        ensure_db()
        if request.httprequest.method == 'GET' and request.session.uid and request.params.get('redirect'):
            # Redirect if already logged in and redirect param is present
            return http.redirect_with_hash(request.params.get('redirect'))
        providers = self.list_providers()

        response = super(OAuthLogin, self).web_login(*args, **kw)
        if response.is_qweb:
            error = request.params.get('oauth_error')
            if error == '1':
                error = _("Sign up is not allowed on this database.")
            elif error == '2':
                error = _("Access Denied")
            elif error == '3':
                error = _("You do not have access to this database or your invitation has expired. Please ask for an invitation and be sure to follow the link in your invitation email.")
            else:
                error = None

            response.qcontext['providers'] = providers
            if error:
                response.qcontext['error'] = error

        return response