diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-04-03 16:38:13 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-04-03 16:38:13 -0500 |
commit | 4ad5af85e20799eda5143120657e131e50aef41d (patch) | |
tree | 9114d544522f273e3f7dcfbe604815fbc9530c66 | |
parent | 14ba9383de2ff03f2af9bf0595c7b8f1fd43ac7a (diff) | |
download | mediagoblin-4ad5af85e20799eda5143120657e131e50aef41d.tar.lz mediagoblin-4ad5af85e20799eda5143120657e131e50aef41d.tar.xz mediagoblin-4ad5af85e20799eda5143120657e131e50aef41d.zip |
Added a check_login command to User
-rw-r--r-- | mediagoblin/models.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mediagoblin/models.py b/mediagoblin/models.py index b1d63181..af10e795 100644 --- a/mediagoblin/models.py +++ b/mediagoblin/models.py @@ -14,9 +14,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +import datetime + from mongokit import Document, Set -import datetime +from mediagoblin.auth import lib as auth_lib class MediaEntry(Document): @@ -61,6 +63,13 @@ class User(Document): 'created': datetime.datetime.utcnow, 'email_verified': False} + def check_login(self, password): + """ + See if a user can login with this password + """ + return auth_lib.bcrypt_check_password( + password, self['pw_hash']) + REGISTER_MODELS = [MediaEntry, User] |