[Python] Is it safe to save the password_hash in a class?

Discussão em 'Python' iniciado por Stack, Julho 30, 2025.

  1. Stack

    Stack Membro Participativo

    basically I'm working in a flask project and I did this script:

    class User(UserMixin):
    def __init__(self, email: str, password_hash: str, username: str) -> None:
    self.email = email
    self.password_hash = password_hash
    self.username = username


    then i show this to my friend and he said that I should not save password hash in User class cuz it was going to be saved in a session and thats not safe apparently and the ideal is to pull from the database every time.

    so is it real or not?

    Continue reading...

Compartilhe esta Página