devise icon indicating copy to clipboard operation
devise copied to clipboard

Rails 7.0 Sign Up no more saving password on alias column

Open vBalatroni opened this issue 3 years ago • 0 comments

Environment

  • Ruby [3.1.2]
  • Rails [7.0.2]
  • Devise [4.8.1]
  • Database postgresql

Premise

Hello, i'm facing a problem linked to registrations: In my app i need to have, or better, must have as main password column a column called Password ( with capitalized P).

Expected behavior

So I found a workaround using an alias_attribute like that:

devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :validatable, :encryptable, encryptor: :sha512
  
alias_attribute :encrypted_password, :Password

It worked good and my password with sha512 hash was correctly stored in the targeted column Password.

Current behavior

Now, after updating Rails v i found out that this Password column is not filled anymore with encrypted_password.

Conclusions:

This solution worked until i changed from rails 6.1 to rails 7, or better, until i changed config.load_defaults from 6.1 to 7.0

Let me know if you need more details, thanks

vBalatroni avatar May 02 '22 09:05 vBalatroni