Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the purpose of this library? #10

Closed
slidenerd opened this issue Oct 11, 2022 · 1 comment
Closed

What is the purpose of this library? #10

slidenerd opened this issue Oct 11, 2022 · 1 comment

Comments

@slidenerd
Copy link

slidenerd commented Oct 11, 2022

I am sorry if this sounds like a stupid question but I honestly did not find anything on the npmjs package or anywhere except the documentation where it shows how to use features

I have a ResetToken model that has 3 fields, account_id, token_expiry_date and the token itself
I hash the tokens using argon2 and store it in the database
My sequelize model already has a beforeUpdate and beforeCreate hook that performs the hashing

  @BeforeUpdate
  @BeforeCreate
  static async makeUpperCase(instance: ResetToken) {
    instance.token = await generateHash(instance.token);
  }

CREATING

Screenshot 2022-10-11 at 6 26 14 PM

When creating a new entry, all I have to do is input the raw token and it immediately stores it in its hash form

VIEWING
Screenshot 2022-10-11 at 6 26 58 PM
When viewing it shows me the hashed value of the token

What does @adminjs/passwords do exactly? The data will already be hashed at the model level, no?
In that features documentation it has 2 properties, encryptedPassword and password? Is this library suppoesd to be used when you are encrypting passwords instead of hashing them to hide the plaintext passwords?

@dziraf
Copy link
Contributor

dziraf commented Oct 11, 2022

This is to allow you to change the password of users if you choose to manage them in the admin panel.

In that features documentation it has 2 properties, encryptedPassword and password

These are used to map values. password is a virtual property used to store the raw value before it is hashed, encryptedPassword is the actual property that gets saved in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants