Major refactoring of get_session(), get_account(), get_nodemailer(), introduces ...
[ndcode_site.git] / api / account / sign_up / create_account.json.jst
index 4c30fc9..2685f30 100644 (file)
@@ -32,8 +32,8 @@ return async env => {
 
       let transaction = await env.site.database.Transaction()
       try {
-        // initialize env.session_key, set cookie in env.response
-        let session = await get_session(env, transaction)
+        let root = await transaction.get({})
+        let session = await get_session(env, root)
 
         let captcha = await session.get('captcha')
         if (
@@ -45,7 +45,7 @@ return async env => {
             `Please call the "/api/verification_image.png" endpoint to create a verification image, in same session as the "/api/account/sign_up/create_account.json" call and less than one hour prior.`,
             418
           )
-        
+
         let captcha_text = await captcha.get_json('text')
         if (verification_code !== captcha_text) {
           console.log(`verification code mismatch, \"${verification_code}\" should be \"${captcha_text}\"`)
@@ -57,10 +57,7 @@ return async env => {
           )
         }
 
-        let accounts = await (
-          await transaction.get({})
-        ).get('accounts', {})
-
+        let accounts = await root.get('accounts', {})
         if (accounts.has(details.email))
           throw new Problem(
             'Account already exists',