Home > Net >  How to redirect extended html to login form in Flask
How to redirect extended html to login form in Flask

Time:11-13

I am trying to redirect to the login page once the session ends, but since I'm using extended HTML template for my dashboard what happens while redirecting though is that the app renders the login page within the sections of the dashboard instead of completely redirecting to the login page, I also looked up for how reload the page by itself using flask yet couldnt find any possible solutions.

This is what is happening enter image description here

The code snippet

    session['user'] = form.username.data
    print(session['user'],']')
    session.permanent = True
    app.permanent_session_lifetime = timedelta(seconds=5)
    session.modified = True

return redirect(url_for('signup'))

All I want to do is redirect to Login once the session ends

CodePudding user response:

Although I couldn't find a proper solution to the above, achieved what I wanted to by using the below code:

    return '<script>window.location = "/login";</script>'

Since this might help someone who wants a fix to the same.

  • Related