try token login first
This commit is contained in:
parent
f42cdec4c4
commit
11dc97da43
|
@ -287,12 +287,20 @@ class Session implements IUserSession, Emitter {
|
||||||
*/
|
*/
|
||||||
public function login($uid, $password) {
|
public function login($uid, $password) {
|
||||||
$this->session->regenerateId();
|
$this->session->regenerateId();
|
||||||
$this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
|
if ($this->validateToken($password)) {
|
||||||
$user = $this->manager->checkPassword($uid, $password);
|
$user = $this->getUser();
|
||||||
if ($user === false) {
|
|
||||||
if ($this->validateToken($password)) {
|
// When logging in with token, the password must be decrypted first before passing to login hook
|
||||||
$user = $this->getUser();
|
try {
|
||||||
|
$token = $this->tokenProvider->getToken($password);
|
||||||
|
$password = $this->tokenProvider->getPassword($token, $password);
|
||||||
|
$this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
|
||||||
|
} catch (InvalidTokenException $ex) {
|
||||||
|
// Invalid token, nothing to do
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
|
||||||
|
$user = $this->manager->checkPassword($uid, $password);
|
||||||
}
|
}
|
||||||
if ($user !== false) {
|
if ($user !== false) {
|
||||||
if (!is_null($user)) {
|
if (!is_null($user)) {
|
||||||
|
|
Loading…
Reference in New Issue