コンテンツへスキップ
メニュー
この質問にフラグが付けられました

I‘m trying to practice making wechat login odoo so that I wrote a custom controller, 

and I got a problem that I do can successfully login, 

but get expired immediately. (The code I'm gonna paste below)

Besides the authenticate method from odoo.http, 

I always tried to use _set_cookie method from odoo.http.session, however, it just wouldn't work(this part of code has been deleted).


Here's my code, very simple lines:

        user = request.env['res.users'].sudo().search([('open_id', '=', wx_openid)])

        if user:


            uid = request.session.authenticate(request.session.db, user.login, "123")

            #request.params['login_success'] = True

            #return request.redirect(self._login_redirect(uid, redirect=None))

            return request.redirect('/web')


Here's my logs:

2024-04-16 11:39:02,433 1583860 INFO JANTON odoo.addons.base.models.res_users: Login successful for db:JANTON login:donglai from 192.168.0.1

2024-04-16 11:39:02,441 1583860 INFO JANTON werkzeug: 192.168.0.1 - - [16/Apr/2024 11:39:02] "POST /wechat/login HTTP/1.1" 303 - 15 0.011 1.108

2024-04-16 11:39:02,564 1583860 INFO JANTON werkzeug: 192.168.0.1 - - [16/Apr/2024 11:39:02] "GET /web HTTP/1.1" 303 - 2 0.004 0.008

2024-04-16 11:39:02,608 1583860 INFO JANTON werkzeug: 192.168.0.1 - - [16/Apr/2024 11:39:02] "GET /web/login HTTP/1.1" 200 - 8 0.009 0.024

2024-04-16 11:39:02,635 1583860 INFO JANTON odoo.http: Session expired

アバター
破棄
関連投稿 返信 ビュー 活動
0
9月 21
200
1
6月 18
4898
0
5月 24
855
0
1月 24
592
0
2月 24
769