fix user password field to not accidentally re-encrypt itself on save
currently this is flagged manually in one place, but there's no reason not to let the user model handle it. this way, you can update your user model from a console or some other area without accidentally changing your password.
This commit is contained in:
@@ -29,10 +29,8 @@ class UsersController < ApplicationController
|
||||
|
||||
if user
|
||||
user.skip_user_id_assign = true
|
||||
user.skip_hash_password = true
|
||||
user.update_attributes(user_params_without_password)
|
||||
if !(params[:user][:password].empty?) && (params[:user][:password] == params[:user][:password_confirmation])
|
||||
user.skip_hash_password = false
|
||||
if params[:user][:password].present? && (params[:user][:password] == params[:user][:password_confirmation])
|
||||
user.password = params[:user][:password]
|
||||
end
|
||||
message = true if user.save!
|
||||
|
||||
Reference in New Issue
Block a user