This repository has been archived by the owner on Oct 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This works the same as the signin redirect. If a user was trying to access a page and gets redirected to sign in or sign up, after succeeding they will be redirected from where they came. Since a user can only be redirected to either the signin or signup page, it is beyond the scope of this feature to pass the query parameter in the url to the other page when requested. Updated signup redirect to work like signin Added signup redirect for SIGNIN_AFTER_SIGNUP
- Loading branch information
Showing
8 changed files
with
73 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import re | ||
|
||
from datetime import datetime, timedelta | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.auth import get_user_model, REDIRECT_FIELD_NAME | ||
from django.core.urlresolvers import reverse | ||
from django.core import mail | ||
from django.contrib.auth.forms import PasswordChangeForm | ||
|
@@ -36,6 +36,30 @@ def test_valid_activation(self): | |
user = User.objects.get(email='[email protected]') | ||
self.assertTrue(user.is_active) | ||
|
||
def test_activation_redirect(self): | ||
""" A ``GET`` to the activation view with redirect parameter """ | ||
|
||
redirect = '/some/url/' | ||
|
||
# First, register an account. | ||
self.client.post('%s?%s=%s' % (reverse('userena_signup'), REDIRECT_FIELD_NAME, redirect), | ||
data={'username': 'alice', | ||
'email': '[email protected]', | ||
'password1': 'swordfish', | ||
'password2': 'swordfish', | ||
'tos': 'on'}) | ||
user = User.objects.get(email='[email protected]') | ||
|
||
# Send a GET request with the redirect parameter to the url | ||
response = self.client.get( | ||
'%s?%s=%s' % (reverse('userena_activate', kwargs={'activation_key': user.userena_signup.activation_key}), | ||
REDIRECT_FIELD_NAME, redirect)) | ||
|
||
self.assertTrue(response.get('Location').endswith(redirect)) | ||
|
||
if hasattr(response, 'url'): | ||
self.assertTrue(response.url.endswith(redirect)) | ||
|
||
def test_activation_expired_retry(self): | ||
""" A ``GET`` to the activation view when activation link is expired """ | ||
# First, register an account. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters