Skip to content

Commit

Permalink
Fix #39. Change password after Google Sinup
Browse files Browse the repository at this point in the history
  • Loading branch information
pmallol committed Dec 14, 2018
1 parent 3e2c915 commit fae69d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 13 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions app/views/devise/registrations/edit.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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("<i>we need your current password to confirm your changes</i>"), :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'
Expand Down

0 comments on commit fae69d8

Please sign in to comment.