let crypto = require('crypto')
+let jst_server = (await import('@ndcode/jst_server')).default
let XDate = require('xdate')
return async env => {
let get_account = await _require('/_lib/get_account.jst')
let get_session = await _require('/_lib/get_session.jst')
let post_request = await _require('/_lib/post_request.jst')
- let Problem = await _require('/_lib/Problem.jst')
await post_request(
// env
old_password = old_password.slice(0, 256)
new_password = new_password.slice(0, 256)
if (old_password.length < 8 || new_password.length < 8)
- throw new Problem(
+ throw new jst_server.Problem(
'Bad request',
'Minimum length check failed',
400
let account = await get_account(root, session)
if (account === undefined)
- throw new Problem('Unauthorized', 'Please sign in first.', 401)
+ throw new jst_server.Problem(
+ 'Unauthorized',
+ 'Please sign in first.',
+ 401
+ )
if (old_password !== await account.get_json('password'))
- throw new Problem(
+ throw new jst_server.Problem(
'Incorrect password',
`Provided old password did not match the expected value.`,
426