Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shirne committed Aug 8, 2024
1 parent f56a196 commit a38a1f9
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions src/application/index/controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,23 +254,24 @@ private function parseDevice($userAgent)
protected function checkLogin()
{
$this->userid = session('userid');

$loginsession = $this->request->cookie(SESSKEY_USER_AUTO_LOGIN);
if (!empty($loginsession)) {
cookie(SESSKEY_USER_AUTO_LOGIN, null);
$data = EncryptService::getInstance()->decrypt($loginsession);
if (!empty($data)) {
$json = json_decode($data, true);
if (!empty($json['hash'])) {
$login = MemberLoginModel::where('hash', $json['hash'])->find();
if (!empty($login)) {
$timestamp = $json['time'];
if ($timestamp >= time()) {
$this->userid = $json['id'];
$member = MemberModel::where('id', $this->userid)->find();
$this->setLogin($member, 0);
$this->user = $member;
$this->setAutoLogin($member, $login['id']);
if (empty($this->userid)) {
$loginsession = $this->request->cookie(SESSKEY_USER_AUTO_LOGIN);
if (!empty($loginsession)) {
cookie(SESSKEY_USER_AUTO_LOGIN, null);
$data = EncryptService::getInstance()->decrypt($loginsession);
if (!empty($data)) {
$json = json_decode($data, true);
if (!empty($json['hash'])) {
$login = MemberLoginModel::where('hash', $json['hash'])->find();
if (!empty($login)) {
$timestamp = $json['time'];
if ($timestamp >= time()) {
$this->userid = $login['member_id'];
$member = MemberModel::where('id', $this->userid)->find();
$this->setLogin($member, 0);
$this->user = $member;
$this->setAutoLogin($member, $login['id']);
}
}
}
}
Expand Down

0 comments on commit a38a1f9

Please sign in to comment.