Features: 1) Allow referrer field to accept a string instead of UUID;
Fixes: None; Extra: 1) Fix indentation inconsistencies in `mutate` method and attribute check block;
This commit is contained in:
parent
11071996af
commit
1b252baf78
1 changed files with 23 additions and 23 deletions
|
|
@ -37,22 +37,22 @@ class CreateUser(BaseMutation):
|
||||||
phone_number = String()
|
phone_number = String()
|
||||||
is_subscribed = Boolean()
|
is_subscribed = Boolean()
|
||||||
language = String()
|
language = String()
|
||||||
referrer = UUID(required=False, description=_("the user's b64-encoded uuid who referred the new user to us."))
|
referrer = String(required=False, description=_("the user's b64-encoded uuid who referred the new user to us."))
|
||||||
|
|
||||||
success = Boolean()
|
success = Boolean()
|
||||||
|
|
||||||
def mutate(
|
def mutate(
|
||||||
self,
|
self,
|
||||||
info,
|
info,
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
confirm_password,
|
confirm_password,
|
||||||
last_name=None,
|
last_name=None,
|
||||||
first_name=None,
|
first_name=None,
|
||||||
phone_number=None,
|
phone_number=None,
|
||||||
is_subscribed=None,
|
is_subscribed=None,
|
||||||
language=None,
|
language=None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
if compare_digest(password, confirm_password):
|
if compare_digest(password, confirm_password):
|
||||||
|
|
@ -138,17 +138,17 @@ class UpdateUser(BaseMutation):
|
||||||
"password",
|
"password",
|
||||||
"confirm_password",
|
"confirm_password",
|
||||||
] and (
|
] and (
|
||||||
attr
|
attr
|
||||||
not in [
|
not in [
|
||||||
"groups",
|
"groups",
|
||||||
"user_permissions",
|
"user_permissions",
|
||||||
"phone_number",
|
"phone_number",
|
||||||
"is_verified",
|
"is_verified",
|
||||||
"is_staff",
|
"is_staff",
|
||||||
"is_active",
|
"is_active",
|
||||||
"is_superuser",
|
"is_superuser",
|
||||||
]
|
]
|
||||||
or info.context.user.has_perm("vibes_auth.change_user")
|
or info.context.user.has_perm("vibes_auth.change_user")
|
||||||
):
|
):
|
||||||
setattr(user, attr, value)
|
setattr(user, attr, value)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue