İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
1134 Görünümler

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!

Avatar
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
4
May 25
2752
2
Oca 25
2135
4
Oca 25
4229
0
Kas 24
1541
1
Kas 24
2331