update:优化auth
This commit is contained in:
parent
e9179ee084
commit
50c8470d73
@ -8,7 +8,6 @@ use catcher\exceptions\FailedException;
|
||||
use catcher\exceptions\LoginFailedException;
|
||||
use thans\jwt\facade\JWTAuth;
|
||||
use think\facade\Session;
|
||||
use think\helper\Str;
|
||||
|
||||
class CatchAuth
|
||||
{
|
||||
@ -65,8 +64,6 @@ class CatchAuth
|
||||
*/
|
||||
public function attempt($condition)
|
||||
{
|
||||
try {
|
||||
|
||||
$user = $this->authenticate($condition);
|
||||
|
||||
if (!$user) {
|
||||
@ -81,10 +78,6 @@ class CatchAuth
|
||||
}
|
||||
|
||||
return $this->{$this->getDriver()}($user);
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -250,8 +243,10 @@ class CatchAuth
|
||||
{
|
||||
$where = [];
|
||||
|
||||
$fields = array_keys(app($this->getProvider()['model'])->getFields());
|
||||
|
||||
foreach ($condition as $field => $value) {
|
||||
if ($field != $this->password) {
|
||||
if (in_array($field, $fields) && $field != $this->password) {
|
||||
$where[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user