mirror of
https://github.com/typecho/typecho.git
synced 2025-01-29 10:21:11 +01:00
fix #1201
This commit is contained in:
parent
d174cc5732
commit
cb4457ab52
@ -28,7 +28,9 @@ include 'header.php';
|
||||
<input type="hidden" name="referer" value="<?php echo htmlspecialchars($request->get('referer')); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="remember"><input type="checkbox" name="remember" class="checkbox" value="1" id="remember" /> <?php _e('下次自动登录'); ?></label>
|
||||
<label for="remember">
|
||||
<input<?php if(\Typecho\Cookie::get('__typecho_remember_remember')): ?> checked<?php endif; ?> type="checkbox" name="remember" class="checkbox" value="1" id="remember" /> <?php _e('下次自动登录'); ?>
|
||||
</label>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
@ -203,7 +203,8 @@ class Response
|
||||
[$key, $value, $timeout, $path, $domain] = $cookie;
|
||||
|
||||
if ($timeout > 0) {
|
||||
$timeout += time();
|
||||
$now = time();
|
||||
$timeout += $timeout > $now - 86400 ? 0 : $now;
|
||||
} elseif ($timeout < 0) {
|
||||
$timeout = 1;
|
||||
}
|
||||
|
@ -1749,8 +1749,7 @@ class Archive extends Contents
|
||||
$this->security->protect();
|
||||
Cookie::set(
|
||||
'protectPassword_' . $this->request->filter('int')->protectCID,
|
||||
$this->request->protectPassword,
|
||||
0
|
||||
$this->request->protectPassword
|
||||
);
|
||||
|
||||
$isPasswordPosted = true;
|
||||
|
@ -216,7 +216,7 @@ class Feedback extends Comments implements ActionInterface
|
||||
}
|
||||
}
|
||||
|
||||
$expire = $this->options->time + $this->options->timezone + 30 * 24 * 3600;
|
||||
$expire = 30 * 24 * 3600;
|
||||
Cookie::set('__typecho_remember_author', $comment['author'], $expire);
|
||||
Cookie::set('__typecho_remember_mail', $comment['mail'], $expire);
|
||||
Cookie::set('__typecho_remember_url', $comment['url'], $expire);
|
||||
|
@ -41,6 +41,14 @@ class Login extends Users implements ActionInterface
|
||||
$validator = new Validate();
|
||||
$validator->addRule('name', 'required', _t('请输入用户名'));
|
||||
$validator->addRule('password', 'required', _t('请输入密码'));
|
||||
$expire = 30 * 24 * 3600;
|
||||
|
||||
/** 记住密码状态 */
|
||||
if ($this->request->remember) {
|
||||
Cookie::set('__typecho_remember_remember', 1, $expire);
|
||||
} elseif (Cookie::get('__typecho_remember_remember')) {
|
||||
Cookie::delete('__typecho_remember_remember');
|
||||
}
|
||||
|
||||
/** 截获验证异常 */
|
||||
if ($error = $validator->run($this->request->from('name', 'password'))) {
|
||||
@ -56,7 +64,7 @@ class Login extends Users implements ActionInterface
|
||||
$this->request->name,
|
||||
$this->request->password,
|
||||
false,
|
||||
1 == $this->request->remember ? $this->options->time + $this->options->timezone + 30 * 24 * 3600 : 0
|
||||
1 == $this->request->remember ? $expire : 0
|
||||
);
|
||||
|
||||
/** 比对密码 */
|
||||
|
@ -33,8 +33,7 @@ class Notice extends Widget
|
||||
$this->highlight = $theId;
|
||||
Cookie::set(
|
||||
'__typecho_notice_highlight',
|
||||
$theId,
|
||||
Options::alloc()->time + Options::alloc()->timezone + 86400
|
||||
$theId
|
||||
);
|
||||
}
|
||||
|
||||
@ -64,13 +63,11 @@ class Notice extends Widget
|
||||
|
||||
Cookie::set(
|
||||
'__typecho_notice',
|
||||
json_encode($notice),
|
||||
Options::alloc()->time + Options::alloc()->timezone + 86400
|
||||
json_encode($notice)
|
||||
);
|
||||
Cookie::set(
|
||||
'__typecho_notice_type',
|
||||
$type,
|
||||
Options::alloc()->time + Options::alloc()->timezone + 86400
|
||||
$type
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user