autoLogin and trustThisDevice are two different things
This commit is contained in:
parent
52f3ab0852
commit
ac8fc71b3b
@ -85,7 +85,7 @@ class LoginRequest {
|
|||||||
String? password;
|
String? password;
|
||||||
String? id;
|
String? id;
|
||||||
String? uuid;
|
String? uuid;
|
||||||
bool? trustThisDevice;
|
bool? autoLogin;
|
||||||
String? type;
|
String? type;
|
||||||
String? verificationCode;
|
String? verificationCode;
|
||||||
Map<String, dynamic> deviceInfo = DeviceInfo.toJson();
|
Map<String, dynamic> deviceInfo = DeviceInfo.toJson();
|
||||||
@ -95,7 +95,7 @@ class LoginRequest {
|
|||||||
this.password,
|
this.password,
|
||||||
this.id,
|
this.id,
|
||||||
this.uuid,
|
this.uuid,
|
||||||
this.trustThisDevice,
|
this.autoLogin,
|
||||||
this.type,
|
this.type,
|
||||||
this.verificationCode});
|
this.verificationCode});
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class LoginRequest {
|
|||||||
if (password != null) data['password'] = password;
|
if (password != null) data['password'] = password;
|
||||||
if (id != null) data['id'] = id;
|
if (id != null) data['id'] = id;
|
||||||
if (uuid != null) data['uuid'] = uuid;
|
if (uuid != null) data['uuid'] = uuid;
|
||||||
if (trustThisDevice != null) data['trustThisDevice'] = trustThisDevice;
|
if (autoLogin != null) data['autoLogin'] = autoLogin;
|
||||||
if (type != null) data['type'] = type;
|
if (type != null) data['type'] = type;
|
||||||
if (verificationCode != null) {
|
if (verificationCode != null) {
|
||||||
data['verificationCode'] = verificationCode;
|
data['verificationCode'] = verificationCode;
|
||||||
|
@ -416,7 +416,7 @@ Future<bool?> loginDialog() async {
|
|||||||
password: password.text,
|
password: password.text,
|
||||||
id: await bind.mainGetMyId(),
|
id: await bind.mainGetMyId(),
|
||||||
uuid: await bind.mainGetUuid(),
|
uuid: await bind.mainGetUuid(),
|
||||||
trustThisDevice: false,
|
autoLogin: true,
|
||||||
type: HttpType.kAuthReqTypeAccount));
|
type: HttpType.kAuthReqTypeAccount));
|
||||||
|
|
||||||
switch (resp.type) {
|
switch (resp.type) {
|
||||||
@ -531,7 +531,7 @@ Future<bool?> loginDialog() async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> verificationCodeDialog(UserPayload? user) async {
|
Future<bool?> verificationCodeDialog(UserPayload? user) async {
|
||||||
var trustThisDevice = false;
|
var autoLogin = true;
|
||||||
var isInProgress = false;
|
var isInProgress = false;
|
||||||
String? errorText;
|
String? errorText;
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ Future<bool?> verificationCodeDialog(UserPayload? user) async {
|
|||||||
username: user?.name,
|
username: user?.name,
|
||||||
id: await bind.mainGetMyId(),
|
id: await bind.mainGetMyId(),
|
||||||
uuid: await bind.mainGetUuid(),
|
uuid: await bind.mainGetUuid(),
|
||||||
trustThisDevice: trustThisDevice,
|
autoLogin: autoLogin,
|
||||||
type: HttpType.kAuthReqTypeEmailCode));
|
type: HttpType.kAuthReqTypeEmailCode));
|
||||||
|
|
||||||
switch (resp.type) {
|
switch (resp.type) {
|
||||||
|
@ -241,8 +241,8 @@ function msgbox(type, title, content, link="", callback=null, height=180, width=
|
|||||||
}
|
}
|
||||||
var remember = false;
|
var remember = false;
|
||||||
try { remember = handler.get_remember(); } catch(e) {}
|
try { remember = handler.get_remember(); } catch(e) {}
|
||||||
var auto_login = false;
|
var autoLogin = false;
|
||||||
try { auto_login = handler.get_option("auto-login") != ''; } catch(e) {}
|
try { autoLogin = handler.get_option("auto-login") != ''; } catch(e) {}
|
||||||
width += is_xfce ? 50 : 0;
|
width += is_xfce ? 50 : 0;
|
||||||
height += is_xfce ? 50 : 0;
|
height += is_xfce ? 50 : 0;
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ function msgbox(type, title, content, link="", callback=null, height=180, width=
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
last_msgbox_tag = type + "-" + title + "-" + content + "-" + link;
|
last_msgbox_tag = type + "-" + title + "-" + content + "-" + link;
|
||||||
$(#msgbox).content(<MsgboxComponent width={width} height={height} auto_login={auto_login} type={type} title={title} content={content} link={link} remember={remember} callback={callback} contentStyle={contentStyle} hasRetry={hasRetry} />);
|
$(#msgbox).content(<MsgboxComponent width={width} height={height} autoLogin={autoLogin} type={type} title={title} content={content} link={link} remember={remember} callback={callback} contentStyle={contentStyle} hasRetry={hasRetry} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
function connecting() {
|
function connecting() {
|
||||||
|
@ -82,7 +82,7 @@ function editOSPassword(login=false) {
|
|||||||
if (!res) return;
|
if (!res) return;
|
||||||
var a0 = handler.get_option('auto-login') != '';
|
var a0 = handler.get_option('auto-login') != '';
|
||||||
var p = (res.password || '').trim();
|
var p = (res.password || '').trim();
|
||||||
var a = res.auto_login || false;
|
var a = res.autoLogin || false;
|
||||||
if (p == p0 && a == a0) return;
|
if (p == p0 && a == a0) return;
|
||||||
if (p != p0) handler.set_option('os-password', p);
|
if (p != p0) handler.set_option('os-password', p);
|
||||||
if (a != a0) handler.set_option('auto-login', a ? 'Y' : '');
|
if (a != a0) handler.set_option('auto-login', a ? 'Y' : '');
|
||||||
|
@ -1248,7 +1248,7 @@ function on_email_check(last_msg) {
|
|||||||
}
|
}
|
||||||
abLoading = true;
|
abLoading = true;
|
||||||
var url = handler.get_api_server();
|
var url = handler.get_api_server();
|
||||||
httpRequest(url + "/api/login", #post, {username: last_msg.user.name, id: my_id, uuid: handler.get_uuid(), type: 'email_code', trustThisDevice: false, verificationCode: code, deviceInfo: getDeviceInfo()},
|
httpRequest(url + "/api/login", #post, {username: last_msg.user.name, id: my_id, uuid: handler.get_uuid(), type: 'email_code', autoLogin: true, verificationCode: code, deviceInfo: getDeviceInfo()},
|
||||||
function(data) {
|
function(data) {
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
abLoading = false;
|
abLoading = false;
|
||||||
|
@ -26,7 +26,7 @@ class MsgboxComponent: Reactor.Component {
|
|||||||
this.remember = params.remember;
|
this.remember = params.remember;
|
||||||
this.callback = params.callback;
|
this.callback = params.callback;
|
||||||
this.hasRetry = params.hasRetry;
|
this.hasRetry = params.hasRetry;
|
||||||
this.auto_login = params.auto_login;
|
this.autoLogin = params.autoLogin;
|
||||||
this.contentStyle = params.contentStyle;
|
this.contentStyle = params.contentStyle;
|
||||||
try { this.content = translate_text(this.content); } catch (e) {}
|
try { this.content = translate_text(this.content); } catch (e) {}
|
||||||
}
|
}
|
||||||
@ -86,10 +86,10 @@ class MsgboxComponent: Reactor.Component {
|
|||||||
} else if (this.type == "session-login-password") {
|
} else if (this.type == "session-login-password") {
|
||||||
return this.getXsessionPasswordContent();
|
return this.getXsessionPasswordContent();
|
||||||
} else if (this.type == "custom-os-password") {
|
} else if (this.type == "custom-os-password") {
|
||||||
var ts = this.auto_login ? { checked: true } : {};
|
var ts = this.autoLogin ? { checked: true } : {};
|
||||||
return <div .form>
|
return <div .form>
|
||||||
<PasswordComponent value={this.content} />
|
<PasswordComponent value={this.content} />
|
||||||
<div><button|checkbox(auto_login) {ts} style="width: *; word-wrap: break-word; overflow-wrap: break-word; white-space: normal; height: auto; overflow: hidden;">{translate('Auto Login')}</button></div>
|
<div><button|checkbox(autoLogin) {ts} style="width: *; word-wrap: break-word; overflow-wrap: break-word; white-space: normal; height: auto; overflow: hidden;">{translate('Auto Login')}</button></div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
return this.content;
|
return this.content;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user