let XDate = require('xdate')
return async env => {
- let get_globals = await _require('/_lib/get_globals.jst')
let get_nodemailer = await _require('/_lib/get_nodemailer.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')
let transaction = await env.site.database.Transaction()
let link_code
- let nodemailer, noreply_from, noreply_signature
+ let nodemailer
+ let noreply_from, noreply_signature
let given_names, family_name
try {
- // initialize env.session_key, set cookie in env.response
- await get_session(env, transaction)
-
- let account = await (
- await (
- await transaction.get({})
- ).get('accounts', {})
- ).get(email)
+ let root = await transaction.get({})
+ let accounts = await root.get('accounts', {})
+ let account = await accounts.get(email)
if (account === undefined)
throw new Problem(
'Account does not exist',
{password, link_code, expires: expires.getTime()}
)
- nodemailer = await get_nodemailer(env, transaction, 'noreply')
- let globals = await get_globals(env, transaction)
+ nodemailer = await get_nodemailer(root, 'noreply')
+
+ let globals = await root.get('globals', {})
site_url = await globals.get_json('site_url')
noreply_from = await globals.get_json('noreply_from')
noreply_signature = await globals.get_json('noreply_signature')