0

I need some help with my project.

I have a user table in my db. I have connected this table to a User model. And I have a user-create form with several inputs. In this form I have a password field, and when I want to submit my form I make from this password field a password_hash and that hash I want to save to my db. The password variables is not saved anywhere.

And now come my problem: When I want to submit, to password_hash was generated, but the password variable is somehow erased or cant reach and when the validation comes, my password is empty, and the submit is not successful, and write it to me, that the Password cannot be blank. But I filled up these field and the hash was generated but somehow the validation is going wrong. And I cant figured out, how to solve this problem.

The password property is write-only, and I know that I can't get these value, but the hash generator is reaching this value, so why can't the validator reach and why cannot be find in the field??? I don't understand whats happening so plz help me.

Amir
  • 484
  • 4
  • 20
Francis
  • 869
  • 1
  • 7
  • 14

1 Answers1

0

if you want to encrypt your password use MD5 or another hashing technique directly no need to use another variable. Or In your case just check before save your password field is required so , If you don't save that field in your database it will through a validation message. So, try to save both password and hash password.

Amitesh Kumar
  • 2,903
  • 22
  • 39