Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
702 Visualizzazioni

Hi everyone,
In this controller even after I enter the correct email and password the page stills the same and doesn't redirect to the hdashboard page, Why is that ?


 @http.route('/login/process', type='http', auth='public', methods=['POST'], website=True, csrf=False)    def login_process(self, **post):        email = post.get('email')        password = post.get('password')        db = request.env.cr.dbname

try: user = request.env['res.users'].sudo().search([('login', '=', email)]) if user and user.password == hashlib.sha256(password.encode()).hexdigest(): uid = user.id request.session.authenticate(db, email, password) print("**********************************") return redirect('/') else: raise ValidationError('Invalid email or password')

        except ValidationError as e:            return http.request.render('test.test_view', {'error': str(e)})
Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
ago 22
3135
1
ott 23
1956
1
mag 25
232
0
mag 25
245
1
mag 25
611