let crypto = require('crypto')
+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 Problem = await _require('/_lib/Problem.jst')
await post_request(
// env
email = email.slice(0, 256).toLowerCase()
link_code = link_code.slice(0, 256).toLowerCase()
if (email.length === 0 || link_code.length < 32)
- throw new Problem(
+ throw new jst_server.Problem(
'Bad request',
'Minimum length check failed',
400
let accounts = await root.get('accounts', {})
let account = await accounts.get(email)
if (account === undefined)
- throw new Problem(
+ throw new jst_server.Problem(
'Account does not exist',
`Please create the account for "${email}" before attempting to verify the password reset link.`
421
verify_password === undefined ||
XDate.now() >= await verify_password.get_json('expires')
)
- throw new Problem(
+ throw new jst_server.Problem(
'Link code missing',
`Password reset link code for account "${email}" does not exist or has expired.`,
423
)
if (link_code !== await verify_password.get_json('link_code'))
- throw new Problem(
+ throw new jst_server.Problem(
'Link code mismatch',
`Provided password reset link code "${link_code}" does not match expected value.`,
423