Commit d42718c3 authored by marcel's avatar marcel
Browse files

Prevent race conditions on register.

parent f8078d94
......@@ -52,13 +52,14 @@ class AjaxController(AbstractController):
user_group = Group.get_or_create_by_name(session, user_group)
user_group.add_user(session, user, Group_User_Assoc.CONFIRMED)
hash = None
if vispa.config("web", "registration.autoactive", True):
return { "hash": user.hash }
hash = user.hash
elif vispa.config("web", "registration.sendmail", False):
User.send_registration_mail(user.name, user.email, user.hash)
return { "hash": None }
return { "hash": hash }
@cherrypy.expose
@cherrypy.tools.user(on=False)
......
......@@ -105,7 +105,9 @@ define([
$("#register-name").focus();
} else {
if (res.data.hash) {
window.location.href = self.url.dynamic("password/" + res.data.hash);
setTimeout(function() {
window.location.href = self.url.dynamic("password/" + res.data.hash);
}, 1000);
} else {
$("#register-success").fadeIn(100);
setTimeout(function() {
......
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