Finish fixing password changing and keeping emails downcased
This commit is contained in:
parent
3afd529379
commit
a4f81c6410
5 changed files with 13 additions and 8 deletions
|
|
@ -21,6 +21,7 @@ class UsersController < ApplicationController
|
|||
|
||||
def update
|
||||
|
||||
password_changed = false
|
||||
u = params[:user]
|
||||
@user = current_user
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ class UsersController < ApplicationController
|
|||
# change password
|
||||
elsif u[:current_password] && u[:password] && u[:password_confirmation]
|
||||
if @user.update_with_password(u)
|
||||
password_changed = true
|
||||
flash[:notice] = I18n.t 'users.update.password_changed'
|
||||
else
|
||||
flash[:error] = I18n.t 'users.update.password_not_changed'
|
||||
|
|
@ -58,7 +60,11 @@ class UsersController < ApplicationController
|
|||
render :nothing => true, :status => 204
|
||||
}
|
||||
format.all{
|
||||
redirect_to edit_user_path
|
||||
if password_changed
|
||||
redirect_to new_user_session_path
|
||||
else
|
||||
redirect_to edit_user_path
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Invitation < ActiveRecord::Base
|
|||
validates_presence_of :sender, :recipient, :aspect
|
||||
|
||||
def self.invite(opts = {})
|
||||
opts[:identifier].downcase!
|
||||
opts[:identifier].downcase! if opts[:identifier]
|
||||
return false if opts[:identifier] == opts[:from].email
|
||||
|
||||
existing_user = self.find_existing_user(opts[:service], opts[:identifier])
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Person < ActiveRecord::Base
|
|||
|
||||
before_validation :downcase_diaspora_handle
|
||||
def downcase_diaspora_handle
|
||||
diaspora_handle.downcase!
|
||||
diaspora_handle.downcase! unless diaspora_handle.blank?
|
||||
end
|
||||
|
||||
has_many :contacts #Other people's contacts for this person
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ en:
|
|||
find_your_friends_on_diaspora: "Would you like to find your Facebook friends on Diaspora?"
|
||||
skip: "Skip"
|
||||
update:
|
||||
password_changed: "Password Changed"
|
||||
password_changed: "Password Changed. You can now log in with your new password."
|
||||
password_not_changed: "Password Change Failed"
|
||||
language_changed: "Language Changed"
|
||||
language_not_changed: "Language Change Failed"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ Feature: Change password
|
|||
And I fill in "user_password" with "newsecret"
|
||||
And I fill in "user_password_confirmation" with "newsecret"
|
||||
And I press "Change Password"
|
||||
Then I should see "Password Changed"
|
||||
When I sign out
|
||||
Then I should be on the home page
|
||||
And I sign in with password "newsecret"
|
||||
Then I should see "Password Changed"
|
||||
Then I should be on the new user session page
|
||||
When I sign in with password "newsecret"
|
||||
Then I should be on the aspects page
|
||||
|
|
|
|||
Loading…
Reference in a new issue