[Flask] Can't get Werkzeug check_password_hash method to work

Abdul Mohammed imonikemohammed at gmail.com
Tue Jun 18 12:27:26 EDT 2019


Thanks Ziirish.
I had a suspicion but I didn't know enough about password hashing to be
sure. I used the MySQL Password() function because I am building
the app in parts. I had done a login module but not a registration module,
which is where I would have used generate_password_hash. I just wanted to
test
the login module and that I had set up SQLAlchemy. I will work on my
registration model making sure to use generate_password_hash and see how it
goes.

Many thanks again.

On Tue, Jun 18, 2019 at 5:14 PM Ziirish <ziirish at ziirish.info> wrote:

> * On Tuesday, June 18, 2019 at 05:01 PM +0100, Abdul Mohammed <
> imonikemohammed at gmail.com> wrote:
> >
> >     def set_password(self, password):
> >        self.password_hash = generate_password_hash(password)
> >
> >     def check_password(self, password):
> >        return check_password_hash(self.password_hash, password)
> >
> >
> > The app is running off a MySQL database and I used the MySQL Password()
> > function to generate the password hashes stored in the database. Please
> > can anyone give me pointers to what I might be doing wrong?
>
> So you mean the password_hash value has actually not been initialized with
> generate_password_hash?
> That would explain why check_password_hash() doesn't work, because MySQL
> Password() function and generate_password_hash() don't return the same
> thing.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20190618/5a2809ce/attachment-0001.html>


More information about the Flask mailing list