Use (Transaction|LazyValue).get_json() instead of logjson.logjson_to_json() and ...
[ndcode_site.git] / api / account / sign_up / create_account.json.jst
index db66bb9..613b1bd 100644 (file)
@@ -1,4 +1,3 @@
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -39,9 +38,7 @@ return async env => {
         let captcha = await session.get('captcha')
         if (
           captcha === undefined ||
-            XDate.now() >= await logjson.logjson_to_json(
-              await captcha.get('expires')
-            )
+            XDate.now() >= await captcha.get_json('expires')
         )
           throw new Problem(
             'No verification image in session',
@@ -49,9 +46,7 @@ return async env => {
             418
           )
         
-        let captcha_text = await logjson.logjson_to_json(
-          await captcha.get('text')
-        )
+        let captcha_text = await captcha.get_json('text')
         if (verification_code !== captcha_text) {
           console.log(`verification code mismatch, \"${verification_code}\" should be \"${captcha_text}\"`)
 
@@ -72,8 +67,8 @@ return async env => {
             `The email "${details.email}" already has an account registered.`,
             420
           )
-        accounts.set(details.email, transaction.json_to_logjson(details))
 
+        accounts.set_json(details.email, details)
         await transaction.commit()
       }
       catch (error) {