Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no demo credentials to test the login #45

Open
divergentsigns opened this issue Jan 25, 2020 · 3 comments
Open

There is no demo credentials to test the login #45

divergentsigns opened this issue Jan 25, 2020 · 3 comments

Comments

@divergentsigns
Copy link

I previously integrated ios app with django passwordless. On submiting the app for review they are asking a demo account from which they can login without having to enter the six digit code. is there any way to create demo credentials for mobile login with phone number and a fixed 6 digit code?

@aaronn
Copy link
Owner

aaronn commented Feb 6, 2020

Interesting– any ideas for how we should handle this in a sane way?

@charleshan
Copy link
Contributor

I added this for this exact purpose: https://github.com/charleshan/django-rest-framework-passwordless/commits/master

There's definitely room for improvement. I just added enough to pass the review process (e.g. The password is hardcoded 😂)

@budlight budlight mentioned this issue Apr 7, 2020
@jws
Copy link
Contributor

jws commented Apr 17, 2020

i hit the same issue with app store reviews. until one of the proposed PRs gets merged, i'm hacking/working around it with a signal:

@receiver(signals.pre_save, sender=passwordless.CallbackToken)
def update_demo_account_token(sender, instance, **kwargs):
    """
    Intercept and update demo account's login token to a constant value.
    """
    demo_token = settings.DEMO_TOKEN_VALUE
    auth_type = passwordless.CallbackToken.TOKEN_TYPE_AUTH


    # check for callback token creation for the demo account
    if instance.user.email != settings.DEMO_USER_EMAIL or instance.type != auth_type or not instance.is_active:
        return

    # tokens can only be used once so we need to delete it from the db
    if passwordless.CallbackToken.objects.filter(key=demo_token, type=auth_type).exists():
        passwordless.CallbackToken.objects.filter(key=demo_token, type=auth_type).delete()

    instance.key = demo_token

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

No branches or pull requests

4 participants