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

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
9月 25
231
5
8月 25
4811
2
8月 25
1491
2
8月 25
719
5
8月 25
10184