Commit 8560f728 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Updated auth methods messages/redirects

- Redirect to index on password reset views (no need for intermediate
  views)
- Show login success message
parent 3dfff7c4
......@@ -40,6 +40,8 @@ ACCOUNT_RESEND_ACTIVATION = 'You have not followed the activatio
INACTIVE_ACCOUNT_CHANGE_EMAIL = ''.join([ACCOUNT_RESEND_ACTIVATION, ' or <a href="%(signup_url)s">Provide new email?</a>'])
ACCOUNT_PENDING_ACTIVATION_HELP = 'If you haven\'t received activation email, be sure to check your spam folder.'
PASSWORD_RESET_DONE = 'A mail with details on how to change your password was sent.'
PASSWORD_RESET_CONFIRM_DONE = 'Password changed. You can now login using your new password.'
ACCOUNT_RESEND_ACTIVATION_PROMPT = 'Resend activation mail'
ACCOUNT_USER_ACTIVATION_PENDING = 'You have not followed the activation link'
......@@ -58,6 +60,7 @@ MEMBER_JOINED_GROUP = '%(realname)s has been successfully
MEMBER_REMOVED = '%(realname)s has been successfully removed from the group.'
BILLING_ERROR = 'Service response status: %(status)d'
LOGOUT_SUCCESS = 'You have successfully logged out.'
LOGIN_SUCCESS = 'You have successfully logged in.'
GENERIC_ERROR = 'Something wrong has happened. \
Please contact the administrators for more details.'
......
......@@ -80,8 +80,8 @@ def login(request, on_failure='im/login.html'):
{'login_form':form,
'next':next,
'key': third_party_token},
context_instance=RequestContext(request)
)
context_instance=RequestContext(request))
# get the user from the cache
user = form.user_cache
......@@ -115,8 +115,22 @@ def login(request, on_failure='im/login.html'):
except PendingThirdPartyUser.DoesNotExist:
messages.error(request, _(astakos_messages.AUTH_PROVIDER_ADD_FAILED))
messages.success(request, _(astakos_messages.LOGIN_SUCCESS))
return response
@require_http_methods(["GET"])
def password_reset_done(request, *args, **kwargs):
messages.success(request, _(astakos_messages.PASSWORD_RESET_DONE))
return HttpResponseRedirect(reverse('index'))
@require_http_methods(["GET"])
def password_reset_confirm_done(request, *args, **kwargs):
messages.success(request, _(astakos_messages.PASSWORD_RESET_CONFIRM_DONE))
return HttpResponseRedirect(reverse('index'))
@require_http_methods(["GET", "POST"])
@signed_terms_required
@login_required
......
......@@ -87,15 +87,23 @@ if 'local' in IM_MODULES:
'post_change_redirect':'profile',
'password_change_form':ExtendedPasswordChangeForm
},
name='password_change')
name='password_change'),
url(r'^local/password_reset/done$', 'local.password_reset_done'),
url(r'^local/reset/confirm/done$',
'local.password_reset_confirm_done')
)
urlpatterns += patterns('django.contrib.auth.views',
url(r'^local/password_reset/?$', 'password_reset',
{'email_template_name':'registration/password_email.txt',
'password_reset_form':ExtendedPasswordResetForm}),
url(r'^local/password_reset/?$', 'password_reset', {
'email_template_name':'registration/password_email.txt',
'password_reset_form':ExtendedPasswordResetForm,
'post_reset_redirect':'password_reset/done'
}),
url(r'^local/password_reset_done/?$', 'password_reset_done'),
url(r'^local/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/?$',
'password_reset_confirm', {'set_password_form':ExtendedSetPasswordForm}),
'password_reset_confirm', {
'set_password_form':ExtendedSetPasswordForm,
'post_reset_redirect': 'done'
}),
url(r'^local/password/reset/complete/?$', 'password_reset_complete')
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment