mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
Logut user after password change, Closes #1047
This commit is contained in:
parent
6256caeb72
commit
fafbdae079
4 changed files with 43 additions and 20 deletions
|
|
@ -12,8 +12,11 @@ class PreferencesController < ApplicationController
|
|||
user_updated = current_user.update_attributes(params['user'])
|
||||
prefs_updated = current_user.preference.update_attributes(params['prefs'])
|
||||
if (user_updated && prefs_updated)
|
||||
notify :notice, "Preferences updated"
|
||||
redirect_to :action => 'index'
|
||||
if !params['user']['password'].blank? # password updated?
|
||||
logout_user t('preferences.password_changed')
|
||||
else
|
||||
preference_updated
|
||||
end
|
||||
else
|
||||
msg = "Preferences could not be updated: "
|
||||
msg += "User model errors; " unless user_updated
|
||||
|
|
@ -28,4 +31,12 @@ class PreferencesController < ApplicationController
|
|||
render :text => l(Date.today, :format => format)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Display notification if preferences are successful updated
|
||||
def preference_updated
|
||||
notify :notice, t('preferences.updated')
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue