Пример #1
0
 /**
  * This method is called when DAV receives an 401 Unauthenticated exception.
  * @return bool true if a response has been sent to the user.
  */
 public function unauthorized()
 {
     DAV::header(array('WWW-Authenticate' => 'Basic realm="' . BeeHub::$CONFIG['authentication']['realm'] . '"', 'Content-Type' => BeeHub::best_xhtml_type()));
     BeeHub::htmlError(file_get_contents(dirname(dirname(__FILE__)) . '/views/error_unauthorized.html'), DAV::HTTP_UNAUTHORIZED);
 }
Пример #2
0
        }
    }
    // Then find the actual user
    $user = null;
    try {
        $user = BeeHub::user($username);
    } catch (DAV_Status $exception) {
        // We don't care yet whether we found a valid user, because that will be checked depending on what the user is actually trying to do.
    }
    // Check whether we need to send a reset code or need to check it
    if (isset($_POST['reset_code']) && !empty($_POST['reset_code'])) {
        if (!is_null($user) && (isset($_POST['new_password']) && !empty($_POST['new_password'])) && (isset($_POST['new_password2']) && $_POST['new_password'] === $_POST['new_password2']) && $user->check_password_reset_code($_POST['reset_code'])) {
            $user->set_password($_POST['new_password']);
            require 'views/password_reset_done.php';
        } else {
            BeeHub::htmlError('<p>The form was not correctly filled out.</p>', DAV::HTTP_BAD_REQUEST);
        }
    } else {
        // Send a new reset code
        if (!is_null($user)) {
            $reset_code = $user->create_password_reset_code();
            $reset_link = BeeHub::urlbase(true) . '/system/password_reset.php?reset_code=' . $reset_code . '&username='******'Dear ' . $user->prop(DAV::PROP_DISPLAYNAME) . ',

  A password reset was requested for your BeeHub account. You can confirm this action by following this link:

  ' . $reset_link . '

  If this link doesn\'t work, you can go to BeeHub and choose \'I forgot my password\' in the login menu. Here, on the \'Enter reset code\' tab you can fill out the following details:

  Username: '******'