Use (Transaction|LazyValue).get_json() instead of logjson.logjson_to_json() and ...
[ndcode_site.git] / api / account / change_password.json.jst
index ce95e13..fbf7486 100644 (file)
@@ -1,5 +1,4 @@
 let crypto = require('crypto')
-let logjson = (await import('@ndcode/logjson')).default
 let XDate = require('xdate')
 
 return async env => {
@@ -35,22 +34,14 @@ return async env => {
           ).get('accounts', {})
         ).get(env.signed_in_as)
 
-        if (
-          old_password !== await logjson.logjson_to_json(
-            await account.get('password')
-          )
-        )
+        if (old_password !== await account.get_json('password'))
           throw new Problem(
             'Incorrect password',
             `Provided old password did not match the expected value.`,
             426
           )
 
-        await account.set(
-          'password',
-          transaction.json_to_logjson(new_password)
-        )
-
+        account.set_json('password', new_password)
         await transaction.commit()
       }
       catch (error) {