autoLogin and trustThisDevice are two different things

This commit is contained in:
rustdesk 2023-06-22 22:11:35 +08:00
parent 52f3ab0852
commit ac8fc71b3b
6 changed files with 14 additions and 14 deletions

View File

@ -85,7 +85,7 @@ class LoginRequest {
String? password;
String? id;
String? uuid;
bool? trustThisDevice;
bool? autoLogin;
String? type;
String? verificationCode;
Map<String, dynamic> deviceInfo = DeviceInfo.toJson();
@ -95,7 +95,7 @@ class LoginRequest {
this.password,
this.id,
this.uuid,
this.trustThisDevice,
this.autoLogin,
this.type,
this.verificationCode});
@ -105,7 +105,7 @@ class LoginRequest {
if (password != null) data['password'] = password;
if (id != null) data['id'] = id;
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 (verificationCode != null) {
data['verificationCode'] = verificationCode;

View File

@ -416,7 +416,7 @@ Future<bool?> loginDialog() async {
password: password.text,
id: await bind.mainGetMyId(),
uuid: await bind.mainGetUuid(),
trustThisDevice: false,
autoLogin: true,
type: HttpType.kAuthReqTypeAccount));
switch (resp.type) {
@ -531,7 +531,7 @@ Future<bool?> loginDialog() async {
}
Future<bool?> verificationCodeDialog(UserPayload? user) async {
var trustThisDevice = false;
var autoLogin = true;
var isInProgress = false;
String? errorText;
@ -564,7 +564,7 @@ Future<bool?> verificationCodeDialog(UserPayload? user) async {
username: user?.name,
id: await bind.mainGetMyId(),
uuid: await bind.mainGetUuid(),
trustThisDevice: trustThisDevice,
autoLogin: autoLogin,
type: HttpType.kAuthReqTypeEmailCode));
switch (resp.type) {

View File

@ -241,8 +241,8 @@ function msgbox(type, title, content, link="", callback=null, height=180, width=
}
var remember = false;
try { remember = handler.get_remember(); } catch(e) {}
var auto_login = false;
try { auto_login = handler.get_option("auto-login") != ''; } catch(e) {}
var autoLogin = false;
try { autoLogin = handler.get_option("auto-login") != ''; } catch(e) {}
width += 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;
$(#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() {

View File

@ -82,7 +82,7 @@ function editOSPassword(login=false) {
if (!res) return;
var a0 = handler.get_option('auto-login') != '';
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) handler.set_option('os-password', p);
if (a != a0) handler.set_option('auto-login', a ? 'Y' : '');

View File

@ -1248,7 +1248,7 @@ function on_email_check(last_msg) {
}
abLoading = true;
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) {
if (data.error) {
abLoading = false;

View File

@ -26,7 +26,7 @@ class MsgboxComponent: Reactor.Component {
this.remember = params.remember;
this.callback = params.callback;
this.hasRetry = params.hasRetry;
this.auto_login = params.auto_login;
this.autoLogin = params.autoLogin;
this.contentStyle = params.contentStyle;
try { this.content = translate_text(this.content); } catch (e) {}
}
@ -86,10 +86,10 @@ class MsgboxComponent: Reactor.Component {
} else if (this.type == "session-login-password") {
return this.getXsessionPasswordContent();
} else if (this.type == "custom-os-password") {
var ts = this.auto_login ? { checked: true } : {};
var ts = this.autoLogin ? { checked: true } : {};
return <div .form>
<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>;
}
return this.content;