await post_request(
// env
env,
- // endpoint
- '/api/sign_up/send_verification_email.json',
// handler
async email => {
// coerce and/or validate
if (account === undefined)
throw new Problem(
'Account does not exist',
- `Please create the account for "${email}" before attempting to send a email verification link.`
+ `Please create the account for "${email}" before attempting to send an email verification link.`
421
)
+ if (
+ await logjson.logjson_to_json(
+ await account.get('email_verified')
+ )
+ )
+ throw new Problem(
+ 'Email already verified',
+ `Your email "${email}" is already verified. You can now sign in.`
+ 422
+ )
+
let link_code = crypto.randomBytes(16).toString('hex')
let expires = new XDate()
expires.addDays(1)