Ejemplo n.º 1
0
function registration_on_confirm(&$api)
{
    $userdb = $api->userdb();
    $user = $userdb->get_user_from_name($_GET['username']);
    assert_user_confirmation_hash_is_valid($user);
    // See if the user still needs to set a password.
    if (!$user->get_password_hash()) {
        $url = new FreechURL(cfg('site_url'));
        $url->set_var('action', 'password_change');
        $url->set_var('username', $user->get_name());
        $url->set_var('hash', $_GET['hash']);
        $api->refer_to($url->get_string());
    }
    // Make the user active.
    $user->set_status(USER_STATUS_ACTIVE);
    $ret = $userdb->save_user($user);
    if ($ret < 0) {
        die('User activation failed');
    }
    // Done.
    include dirname(__FILE__) . '/registration_controller.class.php';
    $registration = new RegistrationController($api);
    $registration->show_done($user);
}
Ejemplo n.º 2
0
 function _password_mail_confirm()
 {
     $user = $this->_get_current_or_confirming_user();
     $userdb = $this->get_userdb();
     $user = $userdb->get_user_from_name($user->get_name());
     assert_user_confirmation_hash_is_valid($user);
     if (!$user->is_active()) {
         die('Error: User status is not active.');
     }
     $this->_password_change();
 }