Beispiel #1
0
        $Log->writeLog();
        SP\Response::printJSON(_('Clave maestra incorrecta'), 4);
    }
}
// Comprobar si se ha forzado un cambio de clave
if ($User->isUserChangePass()) {
    $hash = SP\Util::generate_random_bytes();
    if (UserPassRecover::addPassRecover($userLogin, $hash)) {
        $url = SP\Init::$WEBURI . '/index.php?a=passreset&h=' . $hash . '&t=' . time() . '&f=1';
        SP\Response::printJSON($url, 0);
    }
}
// Obtenemos la clave maestra del usuario
if ($User->getUserMPass()) {
    // Actualizar el último login del usuario
    UserUtil::setUserLastLogin($User->getUserId());
    // Cargar las variables de sesión del usuario
    SessionUtil::loadUserSession($User);
    $Log->addDescription(sprintf('%s: %s', _('Usuario'), $userLogin));
    $Log->addDescription(sprintf('%s: %s', _('Perfil'), SP\Profile::getProfileNameById($User->getUserProfileId())));
    $Log->addDescription(sprintf('%s: %s', _('Grupo'), SP\Groups::getGroupNameById($User->getUserGroupId())));
    $Log->writeLog();
} else {
    SP\Response::printJSON(_('Error interno'));
}
$UserPrefs = \SP\UserPreferences::getPreferences($User->getUserId());
if ($UserPrefs->isUse2Fa()) {
    SP\Session::set2FApassed(false);
    $url = SP\Init::$WEBURI . '/index.php?a=2fa&i=' . $User->getUserId() . '&t=' . time() . '&f=1';
    SP\Response::printJSON($url, 0);
} else {