mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-15 03:58:41 +00:00
Fix login/authentication
This commit is contained in:
parent
e08e441a90
commit
1dac065179
|
|
@ -21,6 +21,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
use phpOMS\DataStorage\Database\Query\Column;
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
use phpOMS\DataStorage\Database\RelationType;
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
use phpOMS\DataStorage\Database\DatabaseType;
|
||||||
|
|
||||||
class AccountMapper extends DataMapperAbstract
|
class AccountMapper extends DataMapperAbstract
|
||||||
{
|
{
|
||||||
|
|
@ -136,14 +137,14 @@ class AccountMapper extends DataMapperAbstract
|
||||||
try {
|
try {
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
switch ($this->connection->getType()) {
|
switch (self::$db->getType()) {
|
||||||
case DatabaseType::MYSQL:
|
case DatabaseType::MYSQL:
|
||||||
|
|
||||||
$sth = $this->connection->con->prepare(
|
$sth = self::$db->con->prepare(
|
||||||
'SELECT
|
'SELECT
|
||||||
`' . $this->connection->prefix . 'account`.*
|
`' . self::$db->prefix . 'account`.*
|
||||||
FROM
|
FROM
|
||||||
`' . $this->connection->prefix . 'account`
|
`' . self::$db->prefix . 'account`
|
||||||
WHERE
|
WHERE
|
||||||
`account_login` = :login'
|
`account_login` = :login'
|
||||||
);
|
);
|
||||||
|
|
@ -167,10 +168,7 @@ class AccountMapper extends DataMapperAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
if (password_verify($password, $result['account_password'])) {
|
if (password_verify($password, $result['account_password'])) {
|
||||||
$this->session->set('UID', $result['account_id']);
|
return $result['account_id'];
|
||||||
$this->session->save();
|
|
||||||
|
|
||||||
return LoginReturnType::OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoginReturnType::WRONG_PASSWORD;
|
return LoginReturnType::WRONG_PASSWORD;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user