You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VerifyView.vue 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template lang="pug">
  2. .wait-message
  3. p.verify-message Thanks for authenticating your email!
  4. p.verify-message Please give us a moment to redirect you back to the survey
  5. </template>
  6. <script>
  7. import { currentProfile, authenticator } from '../services'
  8. let hash = null
  9. export default {
  10. name: 'VerifyView',
  11. async created() {
  12. hash = this.$route.params.hashedToken
  13. let sessionData = null
  14. /** Confirm session with backend */
  15. try {
  16. if (!hash) throw new Error('URL contains no hash!')
  17. sessionData = await authenticator.verifySession(hash)
  18. if (!sessionData.hashesMatch)
  19. throw new Error('Hash is not in activeSessions!')
  20. } catch (err) {
  21. console.error(err)
  22. }
  23. /** Check if session was confirmed and is now valid */
  24. await authenticator.checkSessionValid()
  25. currentProfile.login(
  26. sessionData.profileId,
  27. this.$waveui.notify,
  28. sessionData.accessToken,
  29. )
  30. this.$router.push('/')
  31. }
  32. }
  33. </script>
  34. <style>
  35. .wait-message {
  36. margin: 5rem auto;
  37. text-align: center;
  38. width: 90%;
  39. max-width: 35rem;
  40. font-size: 150%;
  41. font-weight: bold;
  42. }
  43. </style>