mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Simplify SignMe/Remember me code
This commit is contained in:
parent
490465cbbf
commit
5b3b362012
4 changed files with 16 additions and 16 deletions
|
|
@ -138,25 +138,20 @@ export class LoginUserView extends AbstractViewLogin {
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
super.onBuild(dom);
|
super.onBuild(dom);
|
||||||
|
|
||||||
const signMe = (SettingsGet('signMe') || '').toLowerCase();
|
let signMe = (SettingsGet('signMe') || '').toLowerCase();
|
||||||
|
|
||||||
switch (signMe) {
|
switch (signMe) {
|
||||||
case 'defaultoff':
|
case SignMeOff:
|
||||||
case 'defaulton':
|
case SignMeOn:
|
||||||
this.signMeType(
|
|
||||||
'defaulton' === signMe ? SignMeOn : SignMeOff
|
|
||||||
);
|
|
||||||
|
|
||||||
switch (Local.get(ClientSideKeyNameLastSignMe)) {
|
switch (Local.get(ClientSideKeyNameLastSignMe)) {
|
||||||
case '-1-':
|
case '-1-':
|
||||||
this.signMeType(SignMeOn);
|
signMe = SignMeOn;
|
||||||
break;
|
break;
|
||||||
case '-0-':
|
case '-0-':
|
||||||
this.signMeType(SignMeOff);
|
signMe = SignMeOff;
|
||||||
break;
|
break;
|
||||||
// no default
|
// no default
|
||||||
}
|
}
|
||||||
|
this.signMeType(signMe);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.signMeType(SignMeUnused);
|
this.signMeType(SignMeUnused);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace RainLoop;
|
namespace RainLoop;
|
||||||
|
|
||||||
use RainLoop\Enumerations\Capa;
|
use RainLoop\Enumerations\Capa;
|
||||||
|
use RainLoop\Enumerations\SignMeType;
|
||||||
|
|
||||||
class Actions
|
class Actions
|
||||||
{
|
{
|
||||||
|
|
@ -834,7 +835,11 @@ class Actions
|
||||||
$aResult['DevPassword'] = '';
|
$aResult['DevPassword'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$aResult['signMe'] = (string) $oConfig->Get('login', 'sign_me_auto', Enumerations\SignMeType::DEFAULT_OFF);
|
$aResult['signMe'] = [
|
||||||
|
SignMeType::DefaultOff => 0,
|
||||||
|
SignMeType::DefaultOn => 1,
|
||||||
|
SignMeType::Unused => 2
|
||||||
|
][(string) $oConfig->Get('login', 'sign_me_auto', SignMeType::DefaultOff)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ When this value is gethostname, the gethostname() value is used.
|
||||||
|
|
||||||
'login_lowercase' => array(true),
|
'login_lowercase' => array(true),
|
||||||
|
|
||||||
'sign_me_auto' => array(\RainLoop\Enumerations\SignMeType::DEFAULT_OFF,
|
'sign_me_auto' => array(\RainLoop\Enumerations\SignMeType::DefaultOff,
|
||||||
'This option allows webmail to remember the logged in user
|
'This option allows webmail to remember the logged in user
|
||||||
once they closed the browser window.
|
once they closed the browser window.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ namespace RainLoop\Enumerations;
|
||||||
|
|
||||||
abstract class SignMeType
|
abstract class SignMeType
|
||||||
{
|
{
|
||||||
const DEFAULT_OFF = 'DefaultOff';
|
const DefaultOff = 'DefaultOff';
|
||||||
const DEFAULT_ON = 'DefaultOn';
|
const DefaultOn = 'DefaultOn';
|
||||||
const UNUSED = 'Unused';
|
const Unused = 'Unused';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue