0003-automatically-authenticating-user-on-account-activat.patch
authentic2/registration_backend/views.py | ||
---|---|---|
6 | 6 |
from django.contrib import messages |
7 | 7 |
from django.contrib.sites.models import Site, RequestSite |
8 | 8 |
from django.contrib.auth.models import BaseUserManager, Group |
9 |
from django.contrib.auth import authenticate, login |
|
9 | 10 |
from django.conf import settings |
10 | 11 |
from django.db.models import FieldDoesNotExist |
11 | 12 |
from django.db import IntegrityError |
... | ... | |
60 | 61 |
def get(self, request, *args, **kwargs): |
61 | 62 |
context = {} |
62 | 63 |
try: |
63 |
self.register(kwargs['activation_key']) |
|
64 |
return redirect('registration_activation_complete') |
|
64 |
user = authenticate(**self.register(kwargs['activation_key'])) |
|
65 |
login(request, user) |
|
66 |
messages.info(request, _('Your account has been successfully activated. You are now logged in.')) |
|
67 |
return redirect('auth_homepage') |
|
65 | 68 |
except signing.SignatureExpired: |
66 | 69 |
context['expired'] = True |
67 | 70 |
except IntegrityError: |
... | ... | |
101 | 104 |
group, created = Group.objects.get_or_create(name=name) |
102 | 105 |
groups.append(group) |
103 | 106 |
new_user.groups = groups |
104 |
return new_user |
|
107 |
return {'username': registration_fields['username'], |
|
108 |
'password': registration_fields['password1']} |
|
105 | 109 | |
106 | 110 |
class DeleteView(TemplateView): |
107 | 111 |
def get(self, request, *args, **kwargs): |
108 |
- |