mirror of
https://github.com/jazzband/django-ddp.git
synced 2026-05-05 06:04:49 +00:00
Login after create_user as per http://docs.meteor.com/#/full/accounts_createuser
This commit is contained in:
parent
9ddbf7a6ae
commit
5f43879f74
1 changed files with 11 additions and 2 deletions
|
|
@ -264,9 +264,8 @@ class Auth(APIMixin):
|
|||
"`meteor add tysonclugg:accounts-secure` to fix.",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@api_endpoint('createUser')
|
||||
def create_user(params):
|
||||
def create_user(self, params):
|
||||
"""Register a new user account."""
|
||||
receivers = create_user.send(
|
||||
sender=__name__,
|
||||
|
|
@ -275,6 +274,16 @@ class Auth(APIMixin):
|
|||
)
|
||||
if len(receivers) == 0:
|
||||
raise MeteorError(501, 'Handler for `create_user` not registered.')
|
||||
user = receivers[0][1]
|
||||
user = auth.authenticate(
|
||||
username=user.get_username(), password=params['password'],
|
||||
)
|
||||
auth.login(this.request, user)
|
||||
return self.get_user_token(
|
||||
user=user,
|
||||
session_key=this.request.session.session_key,
|
||||
expiry_date=this.request.session.get_expiry_date(),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@api_endpoint
|
||||
|
|
|
|||
Loading…
Reference in a new issue