跳至内容
菜单
此问题已终结
1064 查看

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)})
形象
丢弃
相关帖文 回复 查看 活动
1
8月 22
3453
1
10月 23
2608
1
6月 25
2101
2
6月 25
417
1
6月 25
1174