Skip to content

Commit 6190c45

Browse files
Anthony KinseyAnthony Kinsey
authored andcommitted
refactor: wip port over registration confirmation, get modal working with confimration
1 parent 7f076fb commit 6190c45

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/components/modals/auth/Register.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<template>
22
<modal :name="$options.name" :show="show" @close="close()" :focusInput="focusInput">
3-
<template v-slot:header>Register a new account</template>
3+
<template v-slot:header>
4+
<span v-if="showRegisterHideConfirm">Register a new account</span>
5+
<span v-if="!showRegisterHideConfirm">Confirm Account</span>
6+
</template>
47

58
<template v-slot:body>
6-
<form action="." class="css-form">
9+
<form action="." class="css-form" v-if="showRegisterHideConfirm">
710
<div class='input-section'>
811
<label for="email">
912
Email
@@ -104,7 +107,7 @@
104107
</div>
105108

106109
<div class="modal-actions">
107-
<button class="" @click.prevent="register()" :disabled="!form.valid">
110+
<button @click.prevent="register()" :disabled="!form.valid">
108111
Register
109112
</button>
110113

@@ -117,6 +120,11 @@
117120
</div>
118121
</div>
119122
</form>
123+
124+
<div v-if="!showRegisterHideConfirm">
125+
<p>Thank you for registering. Please check your email and confirm your account.</p>
126+
<button @click.prevent="close()">Close</button>
127+
</div>
120128
</template>
121129
</modal>
122130
</template>
@@ -141,15 +149,8 @@ export default {
141149
}
142150
143151
/* Template Methods */
144-
const register = () => {
145-
$auth.register(v.form.email.val, v.form.username.val, v.form.password.val)
146-
.then(confirm => {
147-
if (confirm) {
148-
console.log('TODO: Confirmation modal')
149-
}
150-
else close()
151-
})
152-
}
152+
const register = () => $auth.register(v.form.email.val, v.form.username.val, v.form.password.val)
153+
.then(confirm => confirm ? v.showRegisterHideConfirm = false : close())
153154
154155
const signInWithGoogle = () => {
155156
console.log('Sign in with Google!')
@@ -176,6 +177,7 @@ export default {
176177
const v = reactive({
177178
form: cloneDeep(initForm),
178179
focusInput: null,
180+
showRegisterHideConfirm: true,
179181
hasGoogleCredentials: true
180182
})
181183

0 commit comments

Comments
 (0)