+let jst_server = (await import('@ndcode/jst_server')).default
let XDate = require('xdate')
return async env => {
let post_request = await _require('/_lib/post_request.jst')
let get_session = await _require('/_lib/get_session.jst')
- let Problem = await _require('/_lib/Problem.jst')
await post_request(
// env
details.given_names.length === 0 ||
details.password.length < 8
)
- throw new Problem(
+ throw new jst_server.Problem(
'Bad request',
'Minimum length check failed',
400
captcha === undefined ||
XDate.now() >= await captcha.get_json('expires')
)
- throw new Problem(
+ throw new jst_server.Problem(
'No verification image in session',
`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
if (verification_code !== captcha_text) {
console.log(`verification code mismatch, \"${verification_code}\" should be \"${captcha_text}\"`)
- throw new Problem(
+ throw new jst_server.Problem(
'Verification code mismatch',
`The provided verification code "${verification_code}" did not match the verification image.`,
419
let accounts = await root.get('accounts', {})
if (accounts.has(details.email))
- throw new Problem(
+ throw new jst_server.Problem(
'Account already exists',
`The email "${details.email}" already has an account registered.`,
420