File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed
Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 1313
1414
1515require __DIR__ . '/src/helpers/headers.inc.php ' ;
16+ require __DIR__ . '/src/helpers/misc.inc.php ' ;
1617require __DIR__ . '/src/config/config.inc.php ' ;
1718require __DIR__ . '/src/config/database.inc.php ' ; // TODO Could find sth cleaner
1819require __DIR__ . '/src/Route/routes.php ' ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public function create(mixed $data): array|object
2828 ->setLastName ($ data ->last )
2929 ->setEmail ($ data ->email )
3030 ->setPhone ($ data ->phone )
31- ->setPassword (password_hash ($ data ->password , PASSWORD_ARGON2I ))
31+ ->setPassword (hashPassword ($ data ->password ))
3232 ->setCreationDate (date (self ::DATE_TIME_FORMAT ));
3333
3434 $ email = $ userEntity ->getEmail ();
Original file line number Diff line number Diff line change 11<?php
22// miscellaneous file (MISC)
33
4+ const PASSWORD_COST_FACTOR = 12 ;
5+
46function response ($ data ): void {
57 echo json_encode ($ data );
68}
9+
10+ function hashPassword (string $ password ): false |null |string {
11+ return password_hash ($ password , PASSWORD_ARGON2I , ['cost ' => PASSWORD_COST_FACTOR ]);
12+ }
You can’t perform that action at this time.
0 commit comments