Ask coding questions

← Back to all posts
Help with Flask Login and Usernames
h
MathBoy1 (0)

So basically, when a user logs onto my flask site and another user logs on too, it shows both the users the same page as the most recent user to login... I tried adding sessions to vital pages to fix this issue, but I've had no luck yet... I was hoping if someone could help me fix it...

Maybe we could contact through Discord (since its a bit more convenient)? My username is ElectroWiz#5313.

Answered by VulcanWM (2903) [earned 5 cycles]
View Answer
Comments
hotnewtop
VulcanWM (2903)

Try adding flask.session like on the functions.py file in here: https://replit.com/@VulcanWM/OvalEyes

MathBoy1 (0)

@VulcanWM I tried using the same but it didnt work...

VulcanWM (2903)

well ive been using it for at least 7 of my projects and its works fine, can you give me a link to your repl? @MathBoy1

MathBoy1 (0)

@VulcanWM sure, Could I have your discord?

VulcanWM (2903)

I don’t have it, you can email me: [email protected] @MathBoy1

MathBoy1 (0)

@VulcanWM I shared the repl... Please help me!

VulcanWM (2903)

i tried my best but it didnt work, i have the same code in my repl but it works so maybe its the repl's problem or maybe it being a private repl? can you try forking the repl and then seeing if it works? @MathBoy1

MathBoy1 (0)

@VulcanWM I tried doing that too, but it didn't work...

MathBoy1 (0)

@VulcanWM I was able to fix it, thanks!

VulcanWM (2903)

Nice! How did you do it? @MathBoy1

MathBoy1 (0)

@VulcanWM Instead of using addcookie(), removecookie() and getcookie(), I used username = session["Username"] on all pages except for login. On the login page i used session["Username"] = username.

VulcanWM (2903)

Ah smart, glad that’s fixed! @MathBoy1

MathBoy1 (0)

btw, im using replDB for user accounts