diff options
-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] |