Skip to content
Snippets Groups Projects

Support email login via REST

Closed delzhand requested to merge issue/tfa-3471828:8.x-1.x into 8.x-1.x
1 file
+ 3
4
Compare changes
  • Side-by-side
  • Inline
@@ -110,12 +110,11 @@ final class TfaUserAuthenticationController extends UserAuthenticationController
@@ -110,12 +110,11 @@ final class TfaUserAuthenticationController extends UserAuthenticationController
throw new BadRequestHttpException('Missing credentials.name.');
throw new BadRequestHttpException('Missing credentials.name.');
}
}
/** @var \Drupal\user\UserInterface[] $users */
$uid = $this->userAuth->authenticate($credentials['name'], $credentials['pass']);
$users = $this->userStorage->loadByProperties(['name' => $credentials['name']]);
if ($uid === false) {
if (count($users) !== 1) {
throw new BadRequestHttpException('Sorry, unrecognized username or password.');
throw new BadRequestHttpException('Sorry, unrecognized username or password.');
}
}
 
$users = $this->userStorage->loadByProperties(['uid' => $uid]);
$this->setUser(reset($users));
$this->setUser(reset($users));
Loading