Commit 4f1ecef1 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Redirect to index after succecssful signup

parent 6a20a951
......@@ -121,7 +121,7 @@ NOTIFICATION_SEND_ERR = EMAIL_SEND_ERR % 'notification'
MISSING_NEXT_PARAMETER = 'No next parameter'
INVITATION_SENT = 'Invitation sent to %(email)s.'
VERIFICATION_SENT = 'Verification sent.'
VERIFICATION_SENT = 'Registration completed but account is not active yet. Account activation link was sent to your email address.'
SWITCH_ACCOUNT_LINK_SENT = 'This email is already associated with another local account. \
To change this account to a shibboleth one follow the link in the verification email sent to %(email)s. \
Otherwise just ignore it.'
......@@ -130,7 +130,7 @@ NOTIFICATION_SENT = 'Your request for an account was suc
Thanks for your interest in ~okeanos! The GRNET team.'
ACTIVATION_SENT = 'Activation sent.'
REGISTRATION_COMPLETED = 'Registration completed. You can now login.'
REGISTRATION_COMPLETED = 'Registration completed you can now login to your account.'
NO_RESPONSE = 'There is no response.'
NOT_ALLOWED_NEXT_PARAM = 'Not allowed next parameter.'
......
......@@ -367,7 +367,10 @@ def edit_profile(request, template_name='im/profile.html', extra_context=None):
@transaction.commit_manually
@require_http_methods(["GET", "POST"])
def signup(request, template_name='im/signup.html', on_success='im/signup_complete.html', extra_context=None, backend=None):
def signup(request, template_name='im/signup.html',
on_success='im/signup_complete.html', extra_context=None,
on_success_redirect='/im/profile/',
backend=None):
"""
Allows a user to create a local account.
......@@ -430,6 +433,7 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
except Exception, e:
form = SimpleBackend(request).get_signup_form(provider)
messages.error(request, e)
if request.method == 'POST':
if form.is_valid():
user = form.save(commit=False)
......@@ -456,13 +460,8 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
return response
messages.add_message(request, status, message)
transaction.commit()
return render_response(
on_success,
context_instance=get_context(
request,
extra_context
)
)
return HttpResponseRedirect(on_success_redirect)
except SendMailError, e:
logger.exception(e)
status = messages.ERROR
......@@ -475,6 +474,7 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
messages.error(request, message)
logger.exception(e)
transaction.rollback()
return render_response(template_name,
signup_form=form,
third_party_token=third_party_token,
......
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