Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Email when mnemonic is entered if exists #3224

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/playground/src/weblets/profile_manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
:disabled="creatingAccount || activatingAccount || activating"
@click:append="reloadValidation"
readonly
@input="getEmail"
:loading="loadEmail"
samaradel marked this conversation as resolved.
Show resolved Hide resolved
ref="mnemonicRef"
@focus="handleFocus(mnemonicRef)"
>
Expand Down Expand Up @@ -260,7 +262,8 @@
placeholder="email@example.com"
v-model="email"
v-bind="props"
:disabled="creatingAccount || activatingAccount || activating"
:loading="loadEmail"
:disabled="creatingAccount || activatingAccount || activating || loadEmail"
readonly
ref="emailRef"
@focus="handleFocus(emailRef)"
Expand Down Expand Up @@ -437,14 +440,15 @@ import { useOnline } from "../hooks";
import { useInputRef } from "../hooks/input_validator";
import { useProfileManager } from "../stores";
import { activateAccountAndCreateTwin, createAccount, getGrid, loadBalance, loadProfile } from "../utils/grid";
import { storeEmail } from "../utils/grid";
import { readEmail, storeEmail } from "../utils/grid";
import { normalizeBalance, normalizeError } from "../utils/helpers";

const items = ref([{ id: 1, name: "stellar" }]);
const depositWallet = ref("");
const selectedName = ref("");
const selectedItem = ref(items.value[0]);
const depositFee = ref(0);
const loadEmail = ref<boolean>(false);
interface Credentials {
passwordHash?: string;
mnemonicHash?: string;
Expand Down Expand Up @@ -887,6 +891,13 @@ watch(openAcceptTerms, async () => {
}
}
});

async function getEmail() {
loadEmail.value = true;
const grid = await getGrid({ mnemonic: mnemonic.value, keypairType: keypairType.value });
email.value = await readEmail(grid!);
loadEmail.value = false;
}
</script>

<script lang="ts">
Expand Down
Loading