In order to avoid forcing the user to press a confirm button, whilst
still not running into the problems we used to have with virus scanners
activating accounts we use javascript to hide and then automatically
submit the confirmation form.
- if params[:confirm_action]
token = UserToken.find_by_token(params[:confirm_string])
if token and !token.user.active?
@user = token.user
token = UserToken.find_by_token(params[:confirm_string])
if token and !token.user.active?
@user = token.user
redirect_to :action => 'account', :display_name => @user.display_name
end
else
redirect_to :action => 'account', :display_name => @user.display_name
end
else
- flash.now[:error] = t 'user.confirm.failure'
+ flash[:error] = t 'user.confirm.failure'
+ redirect_to :action => 'login', :display_name => @user.display_name
end
end
end
def confirm_email
end
end
end
def confirm_email
- if params[:confirm_action]
token = UserToken.find_by_token(params[:confirm_string])
if token and token.user.new_email?
@user = token.user
token = UserToken.find_by_token(params[:confirm_string])
if token and token.user.new_email?
@user = token.user
session[:user] = @user.id
redirect_to :action => 'account', :display_name => @user.display_name
else
session[:user] = @user.id
redirect_to :action => 'account', :display_name => @user.display_name
else
- flash.now[:error] = t 'user.confirm_email.failure'
+ flash[:error] = t 'user.confirm_email.failure'
+ redirect_to :action => 'account', :display_name => @user.display_name
+<script>
+$("content").style.display = "none";
+</script>
+
<h1><%= t 'user.confirm.heading' %></h1>
<p><%= t 'user.confirm.press confirm button' %></p>
<h1><%= t 'user.confirm.heading' %></h1>
<p><%= t 'user.confirm.press confirm button' %></p>
-<form method="post">
-<input type="hidden" name="confirm_string" value="<%= params[:confirm_string] %>">
-<input type="submit" name="confirm_action" value="<%= t 'user.confirm.button' %>">
+<form id="confirm" method="post">
+ <input type="hidden" name="confirm_string" value="<%= params[:confirm_string] %>">
+ <input type="submit" name="confirm_action" value="<%= t 'user.confirm.button' %>">
+<script>
+$("confirm").submit();
+</script>
+<script>
+$("content").style.display = "none";
+</script>
+
<h1><%= t 'user.confirm_email.heading' %></h1>
<p><%= t 'user.confirm_email.press confirm button' %></p>
<h1><%= t 'user.confirm_email.heading' %></h1>
<p><%= t 'user.confirm_email.press confirm button' %></p>
-<form method="post">
-<input type="hidden" name="confirm_string" value="<%= params[:confirm_string] %>">
-<input type="submit" name="confirm_action" value="<%= t 'user.confirm_email.button' %>">
+<form id="confirm" method="post">
+ <input type="hidden" name="confirm_string" value="<%= params[:confirm_string] %>">
+ <input type="submit" name="confirm_action" value="<%= t 'user.confirm_email.button' %>">
+
+<script>
+$("confirm").submit();
+</script>