mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Refact, verification login with secret (#6943)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -1242,9 +1242,10 @@ function login() {
|
||||
}
|
||||
|
||||
function on_2fa_check(last_msg) {
|
||||
var isEmailCheck = !last_msg.tfa_type || last_msg.tfa_type == 'email_check';
|
||||
const isEmailCheck = !last_msg.tfa_type || last_msg.tfa_type == 'email_check';
|
||||
const secret = last_msg.secret;
|
||||
const emailHint = last_msg.user.email;
|
||||
|
||||
var emailHint = last_msg.user.email;
|
||||
msgbox("custom-2fa-verification-code", translate('Verification code'), <div .form .set-password>
|
||||
{ isEmailCheck && <div><span>{translate('Email')}:</span><span>{emailHint}</span></div> }
|
||||
<div><span>{translate(isEmailCheck ? 'Verification code' : '2FA code')}:</span><input|text name="verification_code" .outline-focus /></div>
|
||||
@@ -1260,7 +1261,16 @@ function on_2fa_check(last_msg) {
|
||||
}
|
||||
abLoading = true;
|
||||
var url = handler.get_api_server();
|
||||
const loginData = {username: last_msg.user.name, id: my_id, uuid: handler.get_uuid(), type: 'email_code', verificationCode: code, tfaCode: isEmailCheck ? '' : code, deviceInfo: getDeviceInfo()};
|
||||
const loginData = {
|
||||
username: last_msg.user.name,
|
||||
id: my_id,
|
||||
uuid: handler.get_uuid(),
|
||||
type: 'email_code',
|
||||
verificationCode: code,
|
||||
tfaCode: isEmailCheck ? '' : code,
|
||||
secret: secret,
|
||||
deviceInfo: getDeviceInfo()
|
||||
};
|
||||
httpRequest(url + "/api/login", #post, loginData,
|
||||
function(data) {
|
||||
if (data.error) {
|
||||
|
||||
Reference in New Issue
Block a user