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

Could I config SEND_ACTIVATION_EMAIL base on my function send email ? #695

Open
kev26 opened this issue Sep 23, 2022 · 0 comments
Open

Could I config SEND_ACTIVATION_EMAIL base on my function send email ? #695

kev26 opened this issue Sep 23, 2022 · 0 comments

Comments

@kev26
Copy link

kev26 commented Sep 23, 2022

I'd use an authentication base token, I have a function to generate verify code and send it to email when having a registration, so I want combine 'ACTIVATION_URL': 'activate/{uid}/{token} and 'SEND_ACTIVATION_EMAIL': True,

'SEND_ACTIVATION_EMAIL': True, after having a registration

@api_view(http_method_names=["POST"])
def send_otp(request):
    try:
        email = Member.objects.filter(email=request.data['email']).first()
    except Member.DoesNotExist:
        raise ValidationError("Member does not exists")
    
    digits = "0123456789"
    otp = ""
    for i in range(6):
        otp += digits[math.floor(random.random() * 10)]
    # Send verification email
    send_verification_email(email, top)
    ```

   `'ACTIVATION_URL': 'activate/{uid}/{token}` when the validate code matched    
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

1 participant