diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a0e0f2f51..b0001ad64 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/models/invitation.rb b/app/models/invitation.rb index a0527977f..80336c405 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -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]) diff --git a/app/models/person.rb b/app/models/person.rb index 45128e3db..511c0ccad 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -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 diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 68dc49ff7..1c33450bf 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -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" diff --git a/features/change_password.feature b/features/change_password.feature index d93f2c725..aeb80bad2 100644 --- a/features/change_password.feature +++ b/features/change_password.feature @@ -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