CheckToken fixed
This commit is contained in:
parent
f593e5ac89
commit
106fae305e
@ -63,6 +63,7 @@ namespace Api\User {
|
|||||||
use Api\UserAPI;
|
use Api\UserAPI;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Driver\SQL\Condition\Compare;
|
use Driver\SQL\Condition\Compare;
|
||||||
|
use Views\Account\ConfirmEmail;
|
||||||
|
|
||||||
class Create extends UserAPI {
|
class Create extends UserAPI {
|
||||||
|
|
||||||
@ -451,8 +452,10 @@ class CheckToken extends UserAPI{
|
|||||||
|
|
||||||
$token = $this->getParam('token');
|
$token = $this->getParam('token');
|
||||||
$sql = $this->user->getSQL();
|
$sql = $this->user->getSQL();
|
||||||
$res = $sql->select("token_type")->from("UserToken")
|
$res = $sql->select("UserToken.token_type, User.name, User.email")->from("UserToken")
|
||||||
->where(new Compare("token",$token), new Compare("valid_until", $sql->now(), ">"))
|
->innerJoin("user", "UserToken.user_id","User.uid")
|
||||||
|
->where(new Compare("UserToken.token",$token),
|
||||||
|
new Compare("UserToken.valid_until", $sql->now(), ">"))
|
||||||
->execute();
|
->execute();
|
||||||
$this->lastError = $sql->getLastError();
|
$this->lastError = $sql->getLastError();
|
||||||
$this->success = ($res !== FALSE);
|
$this->success = ($res !== FALSE);
|
||||||
@ -463,11 +466,13 @@ class CheckToken extends UserAPI{
|
|||||||
$this->success = false;
|
$this->success = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->result["token_type"] = $res[0];
|
$this->result["token_type"] = $res[0]["UserToken.token_type"];
|
||||||
$this->result["username"] = $this->user->getUsername();
|
$this->result["username"] = $res[0]["User.username"];
|
||||||
|
$this->result["email"] = $res[0]["User.email"];
|
||||||
}
|
}
|
||||||
return $this->success;
|
return $this->success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user