Skip to content

Fix bug where demo tokens are not created#88

Open
charleshan wants to merge 1 commit into
aaronn:masterfrom
charleshan:fix-demo-user-token-creation
Open

Fix bug where demo tokens are not created#88
charleshan wants to merge 1 commit into
aaronn:masterfrom
charleshan:fix-demo-user-token-creation

Conversation

@charleshan
Copy link
Copy Markdown
Contributor

It looks like these lines are preventing the creation of new tokens with predefined keys so the current implementation doesn't work with existing users. This pull request simply removes those lines.

token = CallbackToken.objects.filter(user=user).first()
if token:
return token
else:
return CallbackToken.objects.create(
user=user,
key=api_settings.PASSWORDLESS_DEMO_USERS[user.pk],
to_alias_type=alias_type_u,
to_alias=getattr(user, to_alias_field),
type=token_type
)

@1beb 1beb mentioned this pull request Feb 8, 2022
Comment thread drfpasswordless/utils.py
to_alias=getattr(user, to_alias_field),
type=token_type
)
return CallbackToken.objects.create(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the way to go: you'd be creating a new callback token every time the user logs in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants