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.

deviseを3系→4系へアップデートするとconfirmation_tokenを使ったユーザ検索に失敗する

Posted at

環境、前提

システムの保守(Rubyのバージョンアップ)に連動してdeviseを3.5.1→4.7.1へアップデートしたら、
confirmation_tokenを使って検索する処理が失敗するようになった。

原因

confirmation_tokenはdevise3系列ではハッシュ化されていたが、4系列から平文で保持するようになった。
なんなら元々が平文で、3.1系からハッシュ化して持つように変わったものが元に戻った。
影響をうけるのはconfirmation_tokenはのみで、reset_password_tokenについてはハッシュ化されたまま。

対策

検索前にtoken_generator.digestを使用してconfirmation_tokenをハッシュ化している処理を削除。

参考

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?