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

Hi everyone,


I need some help configuring a web page that requires user login. Specifically, on my landing page, I have a link that says "Try Our Service Free." When a site visitor clicks this link, I want to check if they are already logged in. If they are logged in, they should be taken to the restricted page. If not, they should be redirected to the login page.


Could anyone advise on how to set this up in a website builder app? 

Thank you!

アバター
破棄
最善の回答

Hi

Use an if statement to check if the user is logged in. If logged in, redirect to the restricted page. If not, redirect to the login page.

Example :    if request.env.user and request.env.user.id != request.env.ref('base.public_user').id:

        return request.redirect('restricted page URL)

    else:

        return request.redirect('/web/login')


Hope it helps

アバター
破棄
関連投稿 返信 ビュー 活動
4
5月 25
2299
2
1月 25
2100
4
1月 25
4169
0
11月 24
1509
1
11月 24
2252