Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
9531 Представления

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!

Аватар
Отменить
Автор Лучший ответ

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
Аватар
Отменить

What are trying to achieve by modifying the login function ?

Автор

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

Автор

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

Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
5
авг. 25
4806
0
авг. 25
216
2
авг. 25
1488
2
авг. 25
719
5
авг. 25
10182