Major refactoring of get_session(), get_account(), get_nodemailer(), introduces ...
[ndcode_site.git] / api / account / sign_up / verify_email.json.jst
index 0e4a932..2517749 100644 (file)
@@ -3,7 +3,6 @@ let XDate = require('xdate')
 
 return async env => {
   let post_request = await _require('/_lib/post_request.jst')
-  let get_session = await _require('/_lib/get_session.jst')
   let Problem = await _require('/_lib/Problem.jst')
 
   await post_request(
@@ -23,14 +22,9 @@ return async env => {
 
       let transaction = await env.site.database.Transaction()
       try {
-        // initialize env.session_key, set cookie in env.response
-        await get_session(env, transaction)
-
-        let account = await (
-          await (
-            await transaction.get({})
-          ).get('accounts', {})
-        ).get(email)
+        let root = await transaction.get({})
+        let accounts = await root.get('accounts', {})
+        let account = await accounts.get(email)
         if (account === undefined)
           throw new Problem(
             'Account does not exist',
@@ -64,7 +58,6 @@ return async env => {
 
         await account.delete('verify_email')
         await account.set('email_verified', true)
-
         await transaction.commit()
       }
       catch (error) {