Skip to content

Commit

Permalink
add support to enable all factors
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Dec 13, 2023
1 parent d5a2dc5 commit 88b4227
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"eslint.workingDirectories": [
{
Expand Down
21 changes: 21 additions & 0 deletions examples/vue-example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<label for="mpc">Enable MPC</label>
<input type="checkbox" id="mpc" name="mpc" v-model="useMpc" />
</div>
<div class="mfa">
<label for="mfa">Enable All MFA Factors</label>
<input type="checkbox" id="mfa" name="mfa" v-model="enableAllFactors" />
</div>
<select v-model="selectedBuildEnv" class="select">
<option :key="login" v-for="login in Object.values(BUILD_ENV)" :value="login">{{ login }}</option>
</select>
Expand Down Expand Up @@ -154,6 +158,7 @@ export default defineComponent({
data() {
return {
loading: false,
enableAllFactors: false,
privKey: "",
ethereumPrivateKeyProvider: null as EthereumPrivateKeyProvider | EthMpcPrivKeyProvider | null,
LOGIN_PROVIDER: LOGIN_PROVIDER,
Expand Down Expand Up @@ -212,6 +217,14 @@ export default defineComponent({
useMpc: this.useMpc,
buildEnv: this.selectedBuildEnv,
// sdkUrl: "https://staging.openlogin.com",
mfaSettings: this.enableAllFactors
? {
backUpShareFactor: { enable: true },
deviceShareFactor: { enable: true },
passwordFactor: { enable: true },
socialBackupFactor: { enable: true },
}
: undefined,
});
op.init();
return op;
Expand All @@ -230,6 +243,14 @@ export default defineComponent({
}
this.openloginInstance.options.uxMode = this.selectedUxMode;
this.openloginInstance.options.whiteLabel = this.isWhiteLabelEnabled ? whitelabel : {};
this.openloginInstance.options.mfaSettings = this.enableAllFactors
? {
backUpShareFactor: { enable: true },
deviceShareFactor: { enable: true },
passwordFactor: { enable: true },
socialBackupFactor: { enable: true },
}
: undefined;
// in popup mode (with third party cookies available) or if user is already logged in this function will
// return priv key , in redirect mode or if third party cookies are blocked then priv key be injected to
// sdk instance after calling init on redirect url page.
Expand Down

0 comments on commit 88b4227

Please sign in to comment.