简体   繁体   中英

How to add an additional password to devise

I need to add a second password field to devise. The original password will be used to login as usual. The second password will be used to "sign" documents.

Any ideas on how to implement this?

I would just generate a migration specifying the data type as string.

1) rails g migration AddPasswordToUser sign_password

2) rake db:migrate

3) update the user_params

I would also use the gem bcrypt to get encrypt the password

https://github.com/codahale/bcrypt-ruby

What do you mean by "signing documents" ? Do you have a Document model ? And a relation between User and Document ?

If yes, you should add the password on the Document model.

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