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

Abdul Mohammed imonikemohammed at gmail.com
Tue Jun 18 18:20:19 EDT 2019


It's an app for vehicle routing. The code provided is for logging into the
app.

On Tue, Jun 18, 2019, 7:28 PM Aco Strkalj <aco at miza.org> wrote:

> What kind of app you building?
>
> On Jun 18, 2019, at 11:28 AM, Abdul Mohammed <imonikemohammed at gmail.com>
> wrote:
>
> *and that I had set up SQLAlchemy correctly.
>
> On Tue, Jun 18, 2019 at 5:27 PM Abdul Mohammed <imonikemohammed at gmail.com>
> wrote:
>
>> 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.
>>>
>> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20190618/ede146a1/attachment-0001.html>


More information about the Flask mailing list