diff --git a/app/models/user.rb b/app/models/user.rb index 832dc7c..a1746ef 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,10 +47,22 @@ def create_openid_token_for(app, issuer = "login.instedd.org") JWT.encode payload, app.secret, 'HS512' end + # update code from devise 3.4.0 to avoid checking current_password + def update_with_password(params, *options) + if params[:password].blank? + params.delete(:password) + params.delete(:password_confirmation) if params[:password_confirmation].blank? + end + + result = update_attributes(params, *options) + + clean_up_passwords + result + end + private def touch_lifespan Telemetry::Lifespan.touch_user(self) end - end diff --git a/app/views/devise/registrations/edit.haml b/app/views/devise/registrations/edit.haml index 45f8ba4..1ca7371 100644 --- a/app/views/devise/registrations/edit.haml +++ b/app/views/devise/registrations/edit.haml @@ -16,10 +16,6 @@ = f.input_field :password_confirmation, placeholder: 'Password confirmation', class: "block password" = f.full_error :password_confirmation - = f.input :current_password, :label => false, :hint => raw("we need your current password to confirm your changes"), :error => false do - = f.input_field :current_password, placeholder: 'Current password', class: "block password" - = f.full_error :current_password - .control-group .controls = f.submit "Update", class: 'btn'