Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit da46877

Browse files
committed
Adding help about verifying hashes when standalone
1 parent 93b2114 commit da46877

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Here's the complete list of available hooks:
239239
- `before`/`afterDelete()`
240240
- `before`/`afterValidate()` - when returning false will halt validation, thus making `save()` operations fail as well since the validation was a failure.
241241

242-
For example, you may use `beforeSave` to hash a users password:
242+
For example, you may use `beforeSave` to hash a users password (actually, it would be a better idea to use [auto-hashing](#automatically-transform-secure-text-attributes)!):
243243

244244
```php
245245
class User extends \LaravelArdent\Ardent\Ardent {
@@ -388,7 +388,9 @@ class User extends \LaravelArdent\Ardent\Ardent {
388388
}
389389
```
390390

391-
Ardent will automatically replace the plain-text password attribute with secure hash checksum and save it to database. It uses the Laravel `Hash::make()` method internally to generate hash.
391+
Ardent will automatically replace the plain-text password attribute with secure hash checksum and save it to database. It uses the Laravel `Hash::make()` method internally to generate hash. _Note: It's advised to use Eloquent's [`$hidden`](https://laravel.com/docs/5.2/eloquent-serialization#hiding-attributes-from-json) attribute so the password, even hashed, won't come out that easily if you're building an API or similar :)_
392+
393+
In case you're using Ardent standalone, you can use `Ardent::$hasher` to verify the field value, using something like `User::$hasher->check($given_password, $user->password)`.
392394

393395

394396
## Updates with Unique Rules

0 commit comments

Comments
 (0)