Added create_user method to Django User model
This commit is contained in:
parent
e0a546000d
commit
d48296eacc
1 changed files with 7 additions and 0 deletions
|
|
@ -52,6 +52,13 @@ class User(Document):
|
|||
algo, salt, hash = self.password.split('$')
|
||||
return hash == get_hexdigest(algo, salt, raw_password)
|
||||
|
||||
@classmethod
|
||||
def create_user(cls, username, password, email=None):
|
||||
user = User(username=username, email=email)
|
||||
user.set_password(password)
|
||||
user.save()
|
||||
return user
|
||||
|
||||
|
||||
class MongoEngineBackend(object):
|
||||
"""Authenticate using MongoEngine and mongoengine.django.auth.User.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue