diff --git a/config/cms.php b/config/cms.php index 0b12b46f2..e6f7c32b9 100644 --- a/config/cms.php +++ b/config/cms.php @@ -51,6 +51,24 @@ return [ 'backendForceSecure' => null, + /* + |-------------------------------------------------------------------------- + | Back-end login remember + |-------------------------------------------------------------------------- + | + | Define live duration of backend sessions : + | + | true - session never expire (cookie expiration in 5 years) + | + | false - session have a limited time (see session.lifetime) + | + | null - The form login display a checkbox that allow user to choose + | wanted behavior + | + */ + + 'backendForceRemember' => true, + /* |-------------------------------------------------------------------------- | Back-end timezone diff --git a/modules/backend/assets/css/october.css b/modules/backend/assets/css/october.css index 5f4fdedd1..115618419 100644 --- a/modules/backend/assets/css/october.css +++ b/modules/backend/assets/css/october.css @@ -819,6 +819,7 @@ body.outer .layout > .layout-row > .layout-cell .outer-form-container h2{font-si body.outer .layout > .layout-row > .layout-cell .outer-form-container .horizontal-form{font-size:0;display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:-ms-flex;display:flex} body.outer .layout > .layout-row > .layout-cell .outer-form-container .horizontal-form input{vertical-align:top;margin-right:9px;display:inline-block;border:none;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px} body.outer .layout > .layout-row > .layout-cell .outer-form-container .horizontal-form button{background:#0181b9;text-align:center;font-size:13px;font-weight:600;height:40px;vertical-align:top;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box} +body.outer .layout > .layout-row > .layout-cell .outer-form-container .remember label {color:rgba(255,255,255,0.44)} body.outer .layout > .layout-row > .layout-cell .outer-form-container .forgot-password{margin-top:30px;font-size:13px;top:8px} body.outer .layout > .layout-row > .layout-cell .outer-form-container .forgot-password a{color:rgba(255,255,255,0.44)} body.outer .layout > .layout-row > .layout-cell .outer-form-container .forgot-password:before{color:rgba(255,255,255,0.44);font-size:14px;position:relative;margin-right:5px} diff --git a/modules/backend/assets/less/layout/outerlayout.less b/modules/backend/assets/less/layout/outerlayout.less index fff4cbb7a..ef77fcb2a 100644 --- a/modules/backend/assets/less/layout/outerlayout.less +++ b/modules/backend/assets/less/layout/outerlayout.less @@ -74,6 +74,12 @@ body.outer { } } + .remember { + label { + color: @color-outer-muted-text; + } + } + .forgot-password { margin-top: 30px; font-size: 13px; diff --git a/modules/backend/controllers/Auth.php b/modules/backend/controllers/Auth.php index c1545d6ae..6a6c72cb4 100644 --- a/modules/backend/controllers/Auth.php +++ b/modules/backend/controllers/Auth.php @@ -69,11 +69,15 @@ class Auth extends Controller throw new ValidationException($validation); } + if (is_null($remember = config('cms.backendForceRemember', true))) { + $remember = (bool) post('remember'); + } + // Authenticate user $user = BackendAuth::authenticate([ 'login' => post('login'), 'password' => post('password') - ], true); + ], $remember); // Load version updates UpdateManager::instance()->update(); diff --git a/modules/backend/controllers/auth/signin.htm b/modules/backend/controllers/auth/signin.htm index b508a74fd..7e186d337 100644 --- a/modules/backend/controllers/auth/signin.htm +++ b/modules/backend/controllers/auth/signin.htm @@ -32,6 +32,21 @@ + + +