confirm.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <script>
  2. const api = require('./api')
  3. const { jwt } = require('./security')
  4. export default {
  5. data() {
  6. return {
  7. model: {
  8. confirmKey: null
  9. }
  10. }
  11. },
  12. methods: {
  13. async submit() {
  14. const result = await api.post('confirm', {
  15. email: this.$route.params.email,
  16. ...this.model
  17. })
  18. console.log(result)
  19. if (result.error) {
  20. this.error = result.error
  21. } else {
  22. jwt.token = result.token
  23. this.$router.push('/dashboard')
  24. }
  25. }
  26. }
  27. }
  28. </script>
  29. <template>
  30. <div>
  31. <h1>Confirm your email address</h1>
  32. <p>
  33. We emailed you a confirmation code. Please enter it here to confirm your email address.
  34. </p>
  35. <p>
  36. <em>I can almost guarantee this email will be in your spam folder, but don't worry. Your email address is only used for signing in, and resetting your password.</em>
  37. </p>
  38. <v-text-field v-model="model.confirmKey" label="Enter your confirmation key" placeholder="###-###" />
  39. <v-btn @click="submit">Confirm Email</v-btn>
  40. <v-alert :value="true" v-if="error" type="error" dismissible>{{error}}</v-alert>
  41. </div>
  42. </template>