Ejemplo n.º 1
0
/**
 * Prevent a manual code login with login().
 *
 * @param string   $event
 * @param string   $type
 * @param ElggUser $user
 * @return bool
 *
 * @throws LoginException
 */
function uservalidationbyemail_check_manual_login($event, $type, $user)
{
    $access_status = access_get_show_hidden_status();
    access_show_hidden_entities(TRUE);
    if ($user instanceof ElggUser && !$user->isEnabled() && !$user->validated) {
        // send new validation email
        uservalidationbyemail_request_validation($user->getGUID());
        // restore hidden entities settings
        access_show_hidden_entities($access_status);
        // throw error so we get a nice error message
        throw new LoginException(elgg_echo('uservalidationbyemail:login:fail'));
    }
    access_show_hidden_entities($access_status);
}
Ejemplo n.º 2
0
/**
 * Prevent a manual code login with login().
 *
 * @param string   $event
 * @param string   $type
 * @param ElggUser $user
 * @return bool
 */
function uservalidationbyadmin_check_manual_login($event, $type, $user)
{
    $access_status = access_get_show_hidden_status();
    access_show_hidden_entities(TRUE);
    // @todo register_error()?
    $return = $user instanceof ElggUser && !$user->isEnabled() && !$user->validated ? FALSE : NULL;
    access_show_hidden_entities($access_status);
    return $return;
}