Merge branch 'vrcx-team:master' into screenshots

This commit is contained in:
Teacup
2023-02-13 15:09:13 -05:00
committed by GitHub
4 changed files with 69 additions and 6 deletions

2
VRCX.csproj.DotSettings Normal file
View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeEditing/Localization/Localizable/@EntryValue">No</s:String></wpf:ResourceDictionary>

View File

@@ -6540,7 +6540,17 @@ speechSynthesis.getVoices();
}
};
$app.data.twoFactorAuthDialogVisible = false;
API.$on('LOGIN', function () {
$app.twoFactorAuthDialogVisible = false;
});
$app.methods.promptTOTP = function () {
if (this.twoFactorAuthDialogVisible) {
return;
}
this.twoFactorAuthDialogVisible = true;
this.$prompt($t('prompt.totp.description'), $t('prompt.totp.header'), {
distinguishCancelAndClose: true,
cancelButtonText: $t('prompt.totp.use_otp'),
@@ -6564,11 +6574,19 @@ speechSynthesis.getVoices();
} else if (action === 'cancel') {
this.promptOTP();
}
},
beforeClose: (action, instance, done) => {
this.twoFactorAuthDialogVisible = false;
done();
}
});
};
$app.methods.promptOTP = function () {
if (this.twoFactorAuthDialogVisible) {
return;
}
this.twoFactorAuthDialogVisible = true;
this.$prompt($t('prompt.otp.description'), $t('prompt.otp.header'), {
distinguishCancelAndClose: true,
cancelButtonText: $t('prompt.otp.use_otp'),
@@ -6592,17 +6610,25 @@ speechSynthesis.getVoices();
} else if (action === 'cancel') {
this.promptTOTP();
}
},
beforeClose: (action, instance, done) => {
this.twoFactorAuthDialogVisible = false;
done();
}
});
};
$app.methods.promptEmailOTP = function () {
if (this.twoFactorAuthDialogVisible) {
return;
}
this.twoFactorAuthDialogVisible = true;
this.$prompt(
$t('prompt.email_otp.description'),
$t('prompt.email_otp.header'),
{
distinguishCancelAndClose: true,
cancelButtonText: $t('prompt.email_otp.cancel'),
cancelButtonText: $t('prompt.email_otp.resend'),
confirmButtonText: $t('prompt.email_otp.verify'),
inputPlaceholder: $t('prompt.email_otp.input_placeholder'),
inputPattern: /^[0-9]{6}$/,
@@ -6620,12 +6646,42 @@ speechSynthesis.getVoices();
API.getCurrentUser();
return args;
});
} else if (action === 'cancel') {
this.resendEmail2fa();
}
},
beforeClose: (action, instance, done) => {
this.twoFactorAuthDialogVisible = false;
done();
}
}
);
};
$app.methods.resendEmail2fa = function () {
if (this.loginForm.lastUserLoggedIn) {
var user =
this.loginForm.savedCredentials[
this.loginForm.lastUserLoggedIn
];
if (typeof user !== 'undefined') {
webApiService.clearCookies();
this.relogin(user).then(() => {
new Noty({
type: 'success',
text: 'Successfully relogged in.'
}).show();
});
return;
}
}
new Noty({
type: 'error',
text: 'Cannot send 2FA email without saved credentials. Please login again.'
}).show();
this.promptEmailOTP();
};
$app.methods.showExportFriendsListDialog = function () {
var {friends} = API.currentUser;
if (Array.isArray(friends) === false) {
@@ -6734,6 +6790,8 @@ speechSynthesis.getVoices();
API.$on('LOGOUT', async function () {
await $app.updateStoredUser(this.currentUser);
webApiService.clearCookies();
// eslint-disable-next-line require-atomic-updates
$app.loginForm.lastUserLoggedIn = '';
configRepository.remove('lastUserLoggedIn');
});
@@ -6901,7 +6959,9 @@ speechSynthesis.getVoices();
API.login({
username: loginParmas.username,
password: pwd,
cipher: loginParmas.password
cipher: loginParmas.password,
endpoint: loginParmas.endpoint,
websocket: loginParmas.websocket
})
.catch((err2) => {
this.loginForm.loading = false;
@@ -6934,9 +6994,10 @@ speechSynthesis.getVoices();
endpoint: loginParmas.endpoint,
websocket: loginParmas.websocket
})
.catch(() => {
.catch((err2) => {
this.loginForm.loading = false;
API.logout();
reject(err2);
})
.then(() => {
this.loginForm.loading = false;
@@ -21984,7 +22045,7 @@ speechSynthesis.getVoices();
API.$on('LOGIN', async function () {
$app.avatarHistory = new Set();
var historyArray = await database.getAvatarHistory();
$app.avatarHistoryArray = historyArray.reverse();
$app.avatarHistoryArray = historyArray;
for (var i = 0; i < historyArray.length; i++) {
$app.avatarHistory.add(historyArray[i].id);
this.applyAvatar(historyArray[i]);

View File

@@ -1073,7 +1073,7 @@
"email_otp": {
"header": "Two-factor Authentication",
"description": "Enter a numeric code that was sent to your email",
"cancel": "Cancel",
"resend": "Resend Email",
"verify": "Verify",
"input_placeholder": "Code",
"input_error": "Invalid Code"

View File

@@ -1583,7 +1583,7 @@ class Database {
updated_at: dbRow[12],
version: dbRow[13]
};
data.unshift(row);
data.push(row);
}, `SELECT * FROM ${Database.userPrefix}_avatar_history INNER JOIN cache_avatar ON cache_avatar.id = ${Database.userPrefix}_avatar_history.avatar_id ORDER BY ${Database.userPrefix}_avatar_history.created_at DESC LIMIT 100`);
return data;
}