Make get_session() readonly and throw an exception if session cannot be found rather...
[ndcode_site.git] / api / account / change_password.json.jst
index 2bba98a..5adc47c 100644 (file)
@@ -24,17 +24,10 @@ return async env => {
 
       let transaction = await env.site.database.Transaction()
       try {
-        let root = await transaction.get({})
+        let root = await transaction.get()
         let session = await get_session(env, root)
 
         let account = await get_account(root, session)
-        if (account === undefined)
-          throw new jst_server.Problem(
-            'Unauthorized',
-            'Please sign in first.',
-            401
-          )
-
         if (old_password !== await account.get_json('password'))
           throw new jst_server.Problem(
             'Incorrect password',