Skip to content

Commit

Permalink
added configuration for usertable fields name
Browse files Browse the repository at this point in the history
  • Loading branch information
nik2208 committed Feb 17, 2022
1 parent 5c7dfda commit 8debf90
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Tqdev/PhpCrudApi/Middleware/DbAuthMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
$method = $request->getMethod();
if ($method == 'POST' && in_array($path, ['login', 'register', 'password'])) {
$body = $request->getParsedBody();
$username = isset($body->username) ? $body->username : '';
$password = isset($body->password) ? $body->password : '';
$newPassword = isset($body->newPassword) ? $body->newPassword : '';
$usernameFormFieldName = $this->getProperty('usernameFormField', 'username');
$passwordFormFieldName = $this->getProperty('passwordFormField', 'username');
$newPasswordFormFieldName = $this->getProperty('newPasswordFormField', 'username');
$username = isset($body->usernameFormFieldName) ? $body->usernameFormFieldName : '';
$password = isset($body->passwordFormFieldName) ? $body->passwordFormFieldName : '';
$newPassword = isset($body->newPasswordFormFieldName) ? $body->newPasswordFormFieldName : '';
$tableName = $this->getProperty('usersTable', 'users');
$table = $this->reflection->getTable($tableName);
$usernameColumnName = $this->getProperty('usernameColumn', 'username');
Expand Down

0 comments on commit 8debf90

Please sign in to comment.