|
|
@@ -61,23 +61,13 @@ export default {
|
|
61
|
61
|
invalidResponse: false,
|
|
62
|
62
|
authenticator: {},
|
|
63
|
63
|
}),
|
|
64
|
|
- // TODO: Heavy refactor comes next, now only cookie is session_token,
|
|
65
|
|
- // which is currently a hashed Key hashedSessions{} registry on the backend
|
|
66
|
|
- // In VerifyView.vue we have a grabTokenFromHash() method which we can
|
|
67
|
|
- // use here to verify any routes
|
|
68
|
|
- // AccessToken lives on backend within hashedSessions{} registry
|
|
69
|
64
|
async created() {
|
|
70
|
65
|
this.survey = await surveyFactory.createSurvey()
|
|
71
|
66
|
this.authenticator = new Authenticator()
|
|
72
|
67
|
hashedSessionToken = this.grabStoredCookie('siimee_session')
|
|
73
|
68
|
try {
|
|
74
|
69
|
const sessionData = await this.verifySession(hashedSessionToken)
|
|
75
|
|
- console.log('sessionData :=>', sessionData)
|
|
76
|
|
- // TODO: Validate All routes hit by these methods using tokens in headers
|
|
77
|
|
- // NOTE: This can be accomplished using sessionData.sessionToken,
|
|
78
|
|
- // as it currently has the raw session token in it
|
|
79
|
|
-
|
|
80
|
|
- // Move this logic onto the backend and have it
|
|
|
70
|
+ // TODO: Move this logic onto the backend and have it
|
|
81
|
71
|
// returned in verifySession(hashedSessionToken)
|
|
82
|
72
|
const userId = await this.grabUserIdByEmail(
|
|
83
|
73
|
sessionData.email,
|
|
|
@@ -117,8 +107,8 @@ export default {
|
|
117
|
107
|
cookieKey in cookies ? cookies[`${cookieKey}`] : undefined
|
|
118
|
108
|
return cookieVal
|
|
119
|
109
|
},
|
|
120
|
|
- // NOTE: sessionToken is flying around far too often
|
|
121
|
|
- // hashedAccessToken
|
|
|
110
|
+ // TODO: sessionToken is flying around far too often,
|
|
|
111
|
+ // see above TODO regarding moving most of this logic to the backend
|
|
122
|
112
|
async verifySession(hashedSessionToken) {
|
|
123
|
113
|
if (!hashedSessionToken)
|
|
124
|
114
|
return console.warn('WARNING :=> sessionToken is not defined')
|
|
|
@@ -201,7 +191,7 @@ export default {
|
|
201
|
191
|
this.responses.push(response)
|
|
202
|
192
|
if (k === 'aspects') return
|
|
203
|
193
|
}
|
|
204
|
|
- // if user as finished minimum profile creation,
|
|
|
194
|
+ // If user has finished minimum profile creation,
|
|
205
|
195
|
// Adds survey answers to responses table and verifies tokens on each step
|
|
206
|
196
|
if (currentProfileId) {
|
|
207
|
197
|
await surveyFactory.addNewSurveyAnswer(
|