function newUser($email, $username, $pw)
{
    require_once 'chipin/users.php';
    require_once 'chipin/passwords.php';
    # XXX: Note, we're not hashing passwords here...
    $uid = DB\insertOne('users', array('email' => $email, 'username' => $username, 'password' => Passwords\hash($pw)), true);
    return User::loadFromID($uid);
}
 function passReset()
 {
     $code = $_GET['c'];
     if (ConfCodes\isValidCode($code)) {
         $u = ConfCodes\getUserForCode($code);
         $this->setAuthenticatedUser($u);
         $newPass = ConfCodes\generate(10);
         $u->updatePassword(Passwords\hash($newPass));
         $this->saveInSession('newPassword', $newPass);
         return $this->redirect('/account/change-password');
     } else {
         $this->saveInSession('invalidConfCode', true);
         return $this->redirect('/account/lost-pass');
     }
 }