public function requestPwReset($username) {
  $setting = new Setting;
  $site_name = $setting->get('site_name');
  $user = $this->get($username, 'username');
  $uid = $this->getSecureID();
  // This has to manually add the resource as Resource/add doesn't have a way to specifiy a userID, it has to be derived from a SID.
  $req = new \JohnVanOrange\Core\Request;
  $data = [
   'ip' => $req->ip(),
   'user_id' => $user['id'],
   'value' => $uid,
   'type' => 'pwreset',
   'public' => 0
  ];
  $query = new \Peyote\Insert('resources');
  $query->columns(array_keys($data))
        ->values(array_values($data));
  $this->db->fetch($query);
  //need to get email address from db as $user->get doesn't return it for security reasons
  $query = new \Peyote\Select('users');
  $query->columns('email')
        ->where('username', '=', $username);
  $email = $this->db->fetch($query);
  $message = new Mail();
  $data = [
   'username'  => $user['username'],
   'reset_key' => $uid
  ];
  $message->sendMessage([$email[0]['email']], 'Password reset request for '. $site_name, 'pwreset', $data);
  return array(
   'message' => 'Reset email sent'
  );
 }