mirror of https://github.com/doccano/doccano.git
pythonannotation-tooldatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learning
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
856 B
24 lines
856 B
from django.contrib.auth import get_user_model, login
|
|
from django.shortcuts import redirect, render
|
|
from django.utils.encoding import force_text
|
|
from django.utils.http import urlsafe_base64_decode
|
|
|
|
from .tokens import account_activation_token
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
def activate(request, uidb64, token):
|
|
try:
|
|
uid = force_text(urlsafe_base64_decode(uidb64))
|
|
user = User.objects.get(pk=uid)
|
|
except(TypeError, ValueError, OverflowError, User.DoesNotExist):
|
|
user = None
|
|
if user is not None and account_activation_token.check_token(user, token):
|
|
user.is_active = True
|
|
user.save()
|
|
user.backend = 'django.contrib.auth.backends.ModelBackend'
|
|
login(request=request, user=user,)
|
|
return redirect('projects')
|
|
else:
|
|
return render(request, 'validate_mail_address_invalid.html')
|