Skip to content

Commit bb0f163

Browse files
authored
Update DbAuthMiddleware.php
Add separate property for login as this could be a view joining users table to other table such as roles, details etc. At a minimum, the view output should include the $usernameColumn and $passwordColumn.
1 parent 3051700 commit bb0f163

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Tqdev/PhpCrudApi/Middleware/DbAuthMiddleware.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
5151
$username = isset($body->$usernameFormFieldName) ? $body->$usernameFormFieldName : '';
5252
$password = isset($body->$passwordFormFieldName) ? $body->$passwordFormFieldName : '';
5353
$newPassword = isset($body->$newPasswordFormFieldName) ? $body->$newPasswordFormFieldName : '';
54-
$tableName = $this->getProperty('usersTable', 'users');
54+
if($path ==='login')
55+
$tableName = $this->getProperty('loginTable', 'users'); //add separate property for login as this could be a view joining users table to other table such as roles, details etc. At a minimum, the view output should include the $usernameColumn and $passwordColumn
56+
else
57+
$tableName = $this->getProperty('usersTable', 'users');
5558
$table = $this->reflection->getTable($tableName);
5659
$usernameColumnName = $this->getProperty('usernameColumn', 'username');
5760
$usernameColumn = $table->getColumn($usernameColumnName);

0 commit comments

Comments
 (0)