lekoala/silverstripe-multi-devices-remember-me
Composer 安装命令:
composer require lekoala/silverstripe-multi-devices-remember-me
包简介
Backports RememberLoginHash from SS4 to SS3 to allow multi devices remember me token
README 文档
README
Backports RememberLoginHash from SS4 to SS3 to allow multi devices remember me token
Code changes
You need to manually edit the following lines in Member.php
Comment the part that sets alc_enc cookies in the logIn function, it will be set by RememberMeExtension::setDeviceCookie
public function logIn($remember = false) { ... // Only set the cookie if autologin is enabled RememberMeExtension::setDeviceCookie($this, $remember); // if($remember && Security::config()->autologin_enabled) { // // Store the hash and give the client the cookie with the token. // $generator = new RandomGenerator(); // $token = $generator->randomToken('sha1'); // $hash = $this->encryptWithUserSettings($token); // $this->RememberLoginToken = $hash; // Cookie::set('alc_enc', $this->ID . ':' . $token, 90, null, null, null, true); // } else { // $this->RememberLoginToken = null; // Cookie::force_expiry('alc_enc'); // } ...
Edit the currentUserID function like this
public static function currentUserID() { $id = Session::get("loggedInAs"); if(!$id && !self::$_already_tried_to_auto_log_in) { RememberMeExtension::autoLoginFromDevice(); $id = Session::get("loggedInAs"); } return is_numeric($id) ? (int) $id : 0; }
Compatibility
Tested with 3.7+
Maintainer
LeKoala - thomas@lekoala.be
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-16