0
我正在使用魔法寶石並嘗試重新驗證用戶以在「我的帳戶」部分更改密碼。所以基本上在表單上有old_password,password和password_confirmation。所以基本上,用戶已經登錄,但我想進行額外的身份驗證檢查來重置用戶的密碼以獲得額外的安全級別。Re =使用魔法寶石驗證用戶
我的問題是:如何用巫術實現這一目標?我正在瀏覽他們的源代碼,並在我認爲是用戶對象的地方發現了「authenticate」方法,但我怎麼稱呼它(注意我對rails比較新,並且仍然與ruby語法有關)
這是我有:
if (@password_reset.valid? && current_user.authenticate(@password_reset.email, @password_reset.old_password))
而且用戶模型
class User < ActiveRecord::Base
authenticates_with_sorcery!
...