简体   繁体   中英

Use Devise::TokenGenerator inside a model that is not devise model

I have a Rails app with devise configured, but I also have a model with simple has_secure_password authentication, and I wish to provide password recover functionality using Devise.token_generator to generate, encrypt and check the forgot password token, but I get unitialized constant SimpleAuthModel::Devise constantly.

Is it possible to use it? require 'devise' doesn't seem to work.

我最终使用了SecureRandom.hex(n) ,它可以正常工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM