Git Product home page Git Product logo

Comments (8)

josevalim avatar josevalim commented on May 11, 2024

Sorry Gavin, but it's not clear for me. You want a method that does it? A view?

from devise.

gavinhughes avatar gavinhughes commented on May 11, 2024

José, what I was trying to say is that it would be nice if Devise offered this right out of the box:

Old password:
New password:
Confirm new password:

from devise.

josevalim avatar josevalim commented on May 11, 2024

If we provide that as view, you would probably need to customize it anyway. I think the only reusable piece would be a method to be used in your controllers. Something like update_with_password. Wdyt?

from devise.

gavinhughes avatar gavinhughes commented on May 11, 2024

From a consumer's point of view, I think it would look good like this:

In Devise.config:
password_update_requires_old_password = true

Then in the view:
:old_password
:new_password
:new_password_confirmation

How's that look?

from devise.

wildchild avatar wildchild commented on May 11, 2024

+1 for current password validation. This is a security issue, no one should be able to change password if user forgot to lock workstation on coffee break.

from devise.

mrrooijen avatar mrrooijen commented on May 11, 2024

I agree to be honest. Would be nice since this is something you probably want to do in (almost) every application. Would be nasty if someone somehow XSS's a session and changes the password of an account. Of course, the developer of the app would be at fault for allows XSS to happen. But yeah, regardless, I believe adding that as a "module" or "add-on", as mentioned above, to be able to handle this would be a nice addition.

from devise.

sobrinho avatar sobrinho commented on May 11, 2024

+1 i guess this will improve security for user

from devise.

carlosantoniodasilva avatar carlosantoniodasilva commented on May 11, 2024

Added update_with_password, so you are able to update the password only when the :old_password is valid. Create a form like this:

form_for @user, :url => update_password_path do |f|
  f.label :old_password
  f.password_field :old_password

  f.label :password
  f.password_field :password

  f.label :password_confirmation
  f.password_field :password_confirmation
end

And use in your controller:

@user.update_with_password(params[:user])

Closing.

from devise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.