pallets-eco / flask-security

Quick and simple security for Flask applications
MIT License
1.63k stars 513 forks source link

__main__.UserDoesNotExist #855

Closed shawnlawyer closed 4 years ago

shawnlawyer commented 4 years ago

Hey folks,

I'm getting an exception in datastore.py at ln 352

not sure why this is happening since this in in a try statement.

return self.user_model.get(self.user_model.id == identifier)

but when i submit the from i get: main.UserDoesNotExist UserDoesNotExist: instance matching query does not exist: SQL: SELECT t1.id, t1.email, t1.password, t1.active FROM user AS t1 WHERE (t1.id = %s) LIMIT %s OFFSET %s Params: ['admin@example.com', 1, 0]

not sure what is going wrong here. i'm using an example for peewee and flask-admin

but this exception coming out of a try statement that should just pass on except is odd to me.

jwag956 commented 4 years ago

This is a bug in FS - the try block needs to catch: except (self.user_model.DoesNotExist, ValueError) which is doesn't in 3.0.0 (it just catches ValueError).

This has been fixed in my (maintained) fork at: https://pypi.org/project/Flask-Security-Too/