İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
9533 Görünümler

Hello, 


I need to access to some private website after the login, now if i put the URL i can access without credentials. I'm using website module

I have odoo 13. Thanks for your help!

Avatar
Vazgeç
Üretici En İyi Yanıt

Thanks, my sites has the followig urls:

https://site.com/xxx
https://site.com/yyy
https://site.com/zzz .... etc there is no a logic with names.

I'm trying to edit odoo/addons/website/controllers/main.py


    # ------------------------------------------------------

    # Login - overwrite of the web login so that regular users are redirected to the backend

    # while portal users are redirected to the frontend by default

    # ------------------------------------------------------


    @http.route(website=True, auth="public", sitemap=False)

    def web_login(self, redirect=None, *args, **kw):

        response = super(Website, self).web_login(redirect=redirect, *args, **kw)

        if not redirect and request.params['login_success']:

            if request.env['res.users'].browse(request.uid).has_group('base.group_user'):

                redirect = b'/web?' + request.httprequest.query_string

            else:

                redirect = '/my'

            return http.redirect_with_hash(redirect)

        return response

it's ok modify there?

thanks
Avatar
Vazgeç

What are trying to achieve by modifying the login function ?

Üretici

Hello, sorry .. i need to get access to sites only after login

Üretici

Hello Niyas, thanks for your link, I understand what you mean. But in my case I create some websites using website odoo module and put links invented by me, for example, https://www.mysite.com/xyz so that xyz is not defined in my main.py.

I need that xyz website has private access.

Thanks for your help

En İyi Yanıt

Hi,

If you are talking about the website pages and if you need to show only the pages if user logged in, you can give auth="user" in the controller which render the page. So if the user is not logged in and if he tries to access the page, odoo will redirect the user to login page and if he get authenticated only he will be able to see the page.


See this: Show WebPage Only For Logged in Users in Odoo


Thanks

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Eyl 25
231
5
Ağu 25
4811
2
Ağu 25
1491
2
Ağu 25
719
5
Ağu 25
10184