|
|
@@ -7,15 +7,12 @@
|
|
7
|
7
|
<script>
|
|
8
|
8
|
import { currentProfile, authenticator } from '../services'
|
|
9
|
9
|
let hash = null
|
|
10
|
|
-let hashedAccessToken = null
|
|
11
|
10
|
export default {
|
|
12
|
11
|
name: 'VerifyView',
|
|
13
|
12
|
async created() {
|
|
14
|
13
|
hash = this.$route.params.hashedToken
|
|
15
|
|
- hashedAccessToken = authenticator.grabStoredCookie('siimee_access')
|
|
16
|
14
|
try {
|
|
17
|
15
|
this.isHashInUrl(hash)
|
|
18
|
|
- await this.doesAccessTokenExist(hashedAccessToken)
|
|
19
|
16
|
await this.verifyActiveSession(hash)
|
|
20
|
17
|
const sessionData =
|
|
21
|
18
|
await authenticator.verifySessionCookie('siimee_session')
|
|
|
@@ -33,10 +30,6 @@ export default {
|
|
33
|
30
|
isHashInUrl(hash) {
|
|
34
|
31
|
if (!hash) throw new Error('URL contains no hash!')
|
|
35
|
32
|
},
|
|
36
|
|
- async doesAccessTokenExist(hashedAccessToken) {
|
|
37
|
|
- if (!hashedAccessToken)
|
|
38
|
|
- throw new Error('accessToken not in cookie store!')
|
|
39
|
|
- },
|
|
40
|
33
|
async verifyActiveSession(hashedToken) {
|
|
41
|
34
|
const sessionData = await authenticator.verifySession(hashedToken)
|
|
42
|
35
|
if (!sessionData.hashesMatch)
|