Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

VerifyView.vue 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. try {
  14. this.isHashInUrl(hash)
  15. await this.verifyActiveSession(hash)
  16. const sessionData =
  17. await authenticator.verifySessionCookie('siimee_session')
  18. currentProfile.login(
  19. sessionData.profileId,
  20. this.$waveui.notify,
  21. sessionData.accessToken,
  22. )
  23. } catch (err) {
  24. console.error(err)
  25. }
  26. this.$router.push('/')
  27. },
  28. methods: {
  29. isHashInUrl(hash) {
  30. if (!hash) throw new Error('URL contains no hash!')
  31. },
  32. async verifyActiveSession(hashedToken) {
  33. const sessionData = await authenticator.verifySession(hashedToken)
  34. if (!sessionData.hashesMatch)
  35. throw new Error('Hash is not in activeSessions!')
  36. },
  37. },
  38. }
  39. </script>
  40. <style>
  41. .wait-message {
  42. margin: 5rem auto;
  43. text-align: center;
  44. width: 90%;
  45. max-width: 35rem;
  46. font-size: 150%;
  47. font-weight: bold;
  48. }
  49. </style>