Resend email button

This commit is contained in:
Natsumi
2023-02-13 08:29:50 +13:00
parent bfc9676885
commit d7b9b8aa2c
3 changed files with 37 additions and 4 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

@@ -6628,7 +6628,7 @@ speechSynthesis.getVoices();
$t('prompt.email_otp.header'), $t('prompt.email_otp.header'),
{ {
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
cancelButtonText: $t('prompt.email_otp.cancel'), cancelButtonText: $t('prompt.email_otp.resend'),
confirmButtonText: $t('prompt.email_otp.verify'), confirmButtonText: $t('prompt.email_otp.verify'),
inputPlaceholder: $t('prompt.email_otp.input_placeholder'), inputPlaceholder: $t('prompt.email_otp.input_placeholder'),
inputPattern: /^[0-9]{6}$/, inputPattern: /^[0-9]{6}$/,
@@ -6646,6 +6646,8 @@ speechSynthesis.getVoices();
API.getCurrentUser(); API.getCurrentUser();
return args; return args;
}); });
} else if (action === 'cancel') {
this.resendEmail2fa();
} }
}, },
beforeClose: (action, instance, done) => { beforeClose: (action, instance, done) => {
@@ -6656,6 +6658,30 @@ speechSynthesis.getVoices();
); );
}; };
$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 () { $app.methods.showExportFriendsListDialog = function () {
var {friends} = API.currentUser; var {friends} = API.currentUser;
if (Array.isArray(friends) === false) { if (Array.isArray(friends) === false) {
@@ -6764,6 +6790,8 @@ speechSynthesis.getVoices();
API.$on('LOGOUT', async function () { API.$on('LOGOUT', async function () {
await $app.updateStoredUser(this.currentUser); await $app.updateStoredUser(this.currentUser);
webApiService.clearCookies(); webApiService.clearCookies();
// eslint-disable-next-line require-atomic-updates
$app.loginForm.lastUserLoggedIn = '';
configRepository.remove('lastUserLoggedIn'); configRepository.remove('lastUserLoggedIn');
}); });
@@ -6931,7 +6959,9 @@ speechSynthesis.getVoices();
API.login({ API.login({
username: loginParmas.username, username: loginParmas.username,
password: pwd, password: pwd,
cipher: loginParmas.password cipher: loginParmas.password,
endpoint: loginParmas.endpoint,
websocket: loginParmas.websocket
}) })
.catch((err2) => { .catch((err2) => {
this.loginForm.loading = false; this.loginForm.loading = false;
@@ -6964,9 +6994,10 @@ speechSynthesis.getVoices();
endpoint: loginParmas.endpoint, endpoint: loginParmas.endpoint,
websocket: loginParmas.websocket websocket: loginParmas.websocket
}) })
.catch(() => { .catch((err2) => {
this.loginForm.loading = false; this.loginForm.loading = false;
API.logout(); API.logout();
reject(err2);
}) })
.then(() => { .then(() => {
this.loginForm.loading = false; this.loginForm.loading = false;

View File

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