0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Rails]Devise で保存されたパスワードを自前で認証したい

Posted at

#課題
Deviseで保存された暗号化パスワードを自前システム用に認証したい

console
irb(main):010:0> user.encrypted_password
=> "$2a$12$vYelOHSlV8xtIfFShoZMIeWoOKVueTDeVQJtyl9JbLQilyLs5h4c."

#結論
valid_password?('string') を使うと出来た。

console
irb(main):011:0> user.valid_password?('password')
=> true

#参考情報
Github devise
https://github.com/heartcombo/devise/blob/master/lib/devise/models/database_authenticatable.rb

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?