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
def app_login(self, redirect=None, **kw): ensure_db() jwt_payload_back = jwt.decode(str(request.params['jwt_token']), secret_token_key) config['remote_server_host_name'] = jwt_payload_back['redirect_url'] if request.httprequest.method == 'GET' and redirect and request.session.uid: return http.redirect_with_hash(redirect) if not request.uid: request.uid = eagle.SUPERUSER_ID values = request.params.copy() if not redirect: redirect = '/web?' + request.httprequest.query_string values['redirect'] = redirect try: values['databases'] = http.db_list() except eagle.exceptions.AccessDenied: values['databases'] = None if request.httprequest.method == 'GET' and not jwt_payload_back[ 'password']: old_uid = request.uid uid = request.session.authenticate(request.session.db, jwt_payload_back['login'], jwt_payload_back['password']) if uid is not False: return http.redirect_with_hash(redirect) request.uid = old_uid values['error'] = _("Wrong login/password") if request.env.ref('web.login', False): # return request.render('web.login', values) return http.redirect_with_hash( "http://localhost:8080/accounts/home/") # return redirect("http://127.0.0.1:8080/accounts/home/") else: # probably not an eagle compatible database error = 'Unable to login on database %s' % request.session.db return werkzeug.utils.redirect( '/web/database/selector?error=%s' % error, 303)
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
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 = b'/web?' + request.httprequest.query_string else: redirect = '/my' return http.redirect_with_hash(redirect) return response