Project

General

Profile

« Previous | Next » 

Revision de851041

Added by Amos Benari almost 11 years ago

  • ID de85104153e359d34cab004c6499d67df829de02

fixes #2639 After creating user with empty e-mail it becomes impossible to add it.
(cherry picked from commit 802ae177dc9d35c3fc3889fa34b24e7f32001eb8)

View differences:

app/controllers/users_controller.rb
end
def update
admin = params[:user].delete :admin
# Remove keys for restricted variables when the user is editing their own account
if editing_self
for key in params[:user].keys
......
User.current.editing_self = true
end
# Only an admin can update admin attribute of another use
# Only an admin can update admin attribute of another user
# this is required, as the admin field is blacklisted above
if User.current.admin
@user.admin = admin
return process_error unless @user.valid?
end
admin = params[:user].delete :admin
@user.admin = admin if User.current.admin
if @user.update_attributes(params[:user])
@user.roles << Role.find_by_name("Anonymous") unless @user.roles.map(&:name).include? "Anonymous"

Also available in: Unified diff