Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can call login page, while I am already login #3

Open
morislwin opened this issue Aug 18, 2020 · 2 comments
Open

can call login page, while I am already login #3

morislwin opened this issue Aug 18, 2020 · 2 comments

Comments

@morislwin
Copy link

I already login and it not show login page but I can call localhost:5000/login in new Tab and can login with different user account. How can I disabled login page while I am login. ( I mean can not call login page in new Tab)

@morislwin morislwin changed the title can call login page can call login page, while I am already login Aug 19, 2020
@technicallyty
Copy link

Just spit-balling ideas here as I'm not an expert, but I would guess you add logic to your '/login' route to check weather the client is logged in already. if client is logged in- take them somewhere else. if they aren't show them login

@kamichal
Copy link

To fix it, change login method like this:

@auth.route('/login')
def login():
    if current_user.is_authenticated:
        return redirect(url_for('main.profile'))

    return render_template('login.html')

The same with sign-up:

@auth.route('/signup')
def signup():
    if current_user.is_authenticated:
        logout_user()
        return redirect(url_for('auth.signup'))

    render_template('signup.html')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants