def lost_password
@title = t "users.lost_password.title"
- if params[:user] && params[:user][:email]
- user = User.visible.find_by(:email => params[:user][:email])
+ if params[:email]
+ user = User.visible.find_by(:email => params[:email])
if user.nil?
- users = User.visible.where("LOWER(email) = LOWER(?)", params[:user][:email])
+ users = User.visible.where("LOWER(email) = LOWER(?)", params[:email])
user = users.first if users.count == 1
end
<p><%= t ".help_text" %></p>
-<%= form_tag :action => "lost_password" do %>
- <div class="standard-form">
- <label class="standard-label"><%= t ".email address" %></label>
- <%= text_field("user", "email", :tabindex => 1) %>
- <%= submit_tag t(".new password button"), :tabindex => 2 %>
- </div>
+<%= bootstrap_form_tag do |f| %>
+ <%= f.text_field :email, :label => t(".email address") %>
+ <%= f.primary t(".new password button") %>
<% end %>
<h1><%= t ".heading", :user => current_user.display_name %></h1>
<% end %>
-<%= error_messages_for current_user %>
-
-<%= form_tag do %>
-<%= hidden_field_tag(:token, params[:token]) %>
- <div class="standard-form">
- <fieldset>
- <label class="standard-label"><%= t ".password" %></label>
- <%= password_field(:user, :pass_crypt, :value => "", :tabindex => 4) %>
- </fieldset>
- <fieldset>
- <label class="standard-label"><%= t ".confirm password" %></label>
- <%= password_field(:user, :pass_crypt_confirmation, :value => "", :tabindex => 5) %>
- </fieldset>
- <%= submit_tag t(".reset"), :tabindex => 6 %>
- </div>
+<%= bootstrap_form_for current_user, :url => { :action => "reset_password" }, :html => { :method => :post } do |f| %>
+ <%= f.hidden_field :token, :name => "token", :value => params[:token] %>
+ <%= f.password_field :pass_crypt, :value => "" %>
+ <%= f.password_field :pass_crypt_confirmation, :value => "" %>
+ <%= f.primary t(".reset") %>
<% end %>
description: "Description"
languages: "Languages"
pass_crypt: "Password"
+ pass_crypt_confirmation: "Confirm Password"
help:
trace:
tagstring: comma delimited
reset_password:
title: "Reset password"
heading: "Reset Password for %{user}"
- password: "Password:"
- confirm password: "Confirm Password:"
reset: "Reset Password"
flash changed: "Your password has been changed."
flash token bad: "Did not find that token, check the URL maybe?"
assert_difference "ActionMailer::Base.deliveries.size", 1 do
perform_enqueued_jobs do
- post user_forgot_password_path, :params => { :user => { :email => user.email } }
+ post user_forgot_password_path, :params => { :email => user.email }
end
end
assert_response :redirect
# that has the same address in a different case
assert_difference "ActionMailer::Base.deliveries.size", 1 do
perform_enqueued_jobs do
- post user_forgot_password_path, :params => { :user => { :email => user.email.upcase } }
+ post user_forgot_password_path, :params => { :email => user.email.upcase }
end
end
assert_response :redirect
# for more than one user but not an exact match for either
assert_no_difference "ActionMailer::Base.deliveries.size" do
perform_enqueued_jobs do
- post user_forgot_password_path, :params => { :user => { :email => user.email.titlecase } }
+ post user_forgot_password_path, :params => { :email => user.email.titlecase }
end
end
assert_response :success
third_user = create(:user)
assert_difference "ActionMailer::Base.deliveries.size", 1 do
perform_enqueued_jobs do
- post user_forgot_password_path, :params => { :user => { :email => third_user.email } }
+ post user_forgot_password_path, :params => { :email => third_user.email }
end
end
assert_response :redirect
# same (case insensitively unique) address in a different case
assert_difference "ActionMailer::Base.deliveries.size", 1 do
perform_enqueued_jobs do
- post user_forgot_password_path, :params => { :user => { :email => third_user.email.upcase } }
+ post user_forgot_password_path, :params => { :email => third_user.email.upcase }
end
end
assert_response :redirect
post user_reset_password_path, :params => { :token => token.token, :user => { :pass_crypt => "new_password", :pass_crypt_confirmation => "different_password" } }
assert_response :success
assert_template :reset_password
- assert_select "div#errorExplanation"
+ assert_select "div.invalid-feedback"
# Test setting a new password
post user_reset_password_path, :params => { :token => token.token, :user => { :pass_crypt => "new_password", :pass_crypt_confirmation => "new_password" } }