Skip to content

Commit

Permalink
πŸš‘οΈ Replace auth inplace popup with redirection (#1767)
Browse files Browse the repository at this point in the history
* πŸš‘οΈ Replace auth inplace popup with redirection

* πŸ₯… Show message in seed word error cases
  • Loading branch information
williamchong authored Oct 31, 2024
1 parent 3752ab1 commit 4c81e6f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 9 additions & 0 deletions pages/in/register/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ const REDIRECT_PATH_NAMES = {
name: 'in-widget-pay',
pathname: '/in/widget/pay',
},
SEEDWORD_WIDGET: {
name: 'in-widget-authcore-seedwords',
pathname: '/in/widget/authcore/seedwords',
},
};
Expand Down Expand Up @@ -445,6 +449,11 @@ export default {
query: Object.fromEntries(new URLSearchParams(redirectUrl.search)),
hash: redirectUrl.hash,
};
case REDIRECT_PATH_NAMES.SEEDWORD_WIDGET.pathname:
return {
name: REDIRECT_PATH_NAMES.SEEDWORD_WIDGET.name,
query: Object.fromEntries(new URLSearchParams(redirectUrl.search)),
};
default:
return redirectUrl;
}
Expand Down
12 changes: 9 additions & 3 deletions pages/in/widget/authcore/seedwords.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
</button>
</div>
<div
v-else-if="getAuthCoreNeedReAuth"
v-else-if="!getAuthCoreAuthClient || getAuthCoreNeedReAuth"
class="create-account-wrapper"
>
<button
Expand Down Expand Up @@ -153,7 +153,6 @@ export default {
},
methods: {
...mapActions([
'popupAuthDialogInPlace',
'setReAuthDialogShow',
'forceAuthCoreReAuth',
]),
Expand All @@ -165,6 +164,8 @@ export default {
const res = await authClient.startSecretdExportAuthentication();
this.isPasswordNeeded = res.challenges.includes('PASSWORD');
this.isInited = true;
} else {
throw new Error('authClient is not initialized');
}
} catch (err) {
// If the user resets his password via forget password flow
Expand All @@ -180,7 +181,10 @@ export default {
this.isShowWarning = false;
},
onClickSignInButton() {
this.popupAuthDialogInPlace({ route: this.$route, isSignIn: true });
this.$router.push({
name: 'in-register',
query: { platform: 'authcore', redirect: `${window.location.origin}${this.$route.fullPath}` },
});
},
onClickAuthCoreReAuth() {
this.setReAuthDialogShow(true);
Expand All @@ -195,6 +199,8 @@ export default {
if (this.isInited && !this.error) {
await this.getAccessToken();
await this.exportSeedWords();
} else {
throw new Error('NOT_INITIALIZED');
}
} catch (err) {
console.error(err);
Expand Down

0 comments on commit 4c81e6f

Please sign in to comment.