mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
Address next batch of UX issues
This commit is contained in:
parent
4c53ec6dd3
commit
db8e2c3bf2
@ -265,9 +265,9 @@ async function UIWindowLogin(options){
|
|||||||
new RecoveryCodeEntryView({
|
new RecoveryCodeEntryView({
|
||||||
_ref: me => recovery_entry = me,
|
_ref: me => recovery_entry = me,
|
||||||
async [`property.value`] (value, { component }) {
|
async [`property.value`] (value, { component }) {
|
||||||
|
let error_i18n_key = 'something_went_wrong';
|
||||||
if ( ! value ) return;
|
if ( ! value ) return;
|
||||||
console.log('token?', data.otp_jwt_token);
|
try {
|
||||||
console.log('what about the rest of the data?', data);
|
|
||||||
const resp = await fetch(`${api_origin}/login/recovery-code`, {
|
const resp = await fetch(`${api_origin}/login/recovery-code`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -279,17 +279,27 @@ async function UIWindowLogin(options){
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ( resp.status === 429 ) {
|
||||||
|
error_i18n_key = 'confirm_code_generic_too_many_requests';
|
||||||
|
throw new Error('expected error');
|
||||||
|
}
|
||||||
|
|
||||||
const next_data = await resp.json();
|
const next_data = await resp.json();
|
||||||
|
|
||||||
if ( ! next_data.proceed ) {
|
if ( ! next_data.proceed ) {
|
||||||
component.set('error', i18n('confirm_code_generic_incorrect'));
|
error_i18n_key = 'confirm_code_generic_incorrect';
|
||||||
return;
|
throw new Error('expected error');
|
||||||
}
|
}
|
||||||
|
|
||||||
data = next_data;
|
data = next_data;
|
||||||
|
|
||||||
$(win).close();
|
$(win).close();
|
||||||
p.resolve();
|
p.resolve();
|
||||||
|
} catch (e) {
|
||||||
|
// keeping this log; useful in screenshots
|
||||||
|
console.log('2FA Recovery Error', e);
|
||||||
|
component.set('error', i18n(error_i18n_key));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new Button({
|
new Button({
|
||||||
|
Loading…
Reference in New Issue
Block a user