Skip to content

Commit

Permalink
feat: create auth method for confirming registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Kinsey authored and Anthony Kinsey committed Feb 2, 2022
1 parent 4fb401e commit c2d9ef7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/composables/stores/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,16 @@ export default {
$alertStore.success(`Welcome ${user.username}, you have successfully registered!`)
socketLogin(user)
}
else return true
// TODO(akinsey): implement flow for when email confirmation is enabled
// else {}
else return true // when email confirmation is enabled, tell modal to show confirmation msg
}).catch(() => {})

const confirmRegistration = (username, token) => authApi.confirmRegistration({ username, token })
.then(dbUser => {
$appCache.set(AUTH_KEY, dbUser)
Object.assign(user, dbUser)
$prefs.fetch()
$alertStore.success(`Welcome ${user.username}, you have successfully registered!`)
socketLogin(user)
}).catch(() => {})

// Reauthenticate on app init if token is present
Expand All @@ -100,7 +107,8 @@ export default {
reauthenticate,
login,
logout,
register
register,
confirmRegistration
})
},
render() { return this.$slots.default() } // renderless component
Expand Down

0 comments on commit c2d9ef7

Please sign in to comment.