diff --git a/inc/Plugins/Authenticator/ActionController.class.php b/inc/Plugins/Authenticator/ActionController.class.php deleted file mode 100644 index a9440e31..00000000 --- a/inc/Plugins/Authenticator/ActionController.class.php +++ /dev/null @@ -1,349 +0,0 @@ -. - */ - -namespace Plugins\Authenticator; - -use Defuse\Crypto\Exception\EnvironmentIsBrokenException; -use SP\Controller\ItemControllerInterface; -use SP\Controller\RequestControllerTrait; -use SP\Core\Exceptions\SPException; -use SP\Core\Messages\LogMessage; -use SP\Core\Plugin\PluginDataStore; -use SP\Core\Session as CoreSession; -use SP\DataModel\PluginData; -use SP\Http\Request; -use SP\Log\Email; -use SP\Mgmt\Plugins\Plugin; -use SP\Util\ArrayUtil; -use SP\Util\Checks; -use SP\Util\Json; -use SP\Util\Util; - -/** - * Class ActionController - * - * @package Plugins\Authenticator - */ -class ActionController implements ItemControllerInterface -{ - const ACTION_TWOFA_SAVE = 1; - const ACTION_TWOFA_CHECKCODE = 2; - - use RequestControllerTrait; - - /** - * @var AuthenticatorPlugin - */ - protected $Plugin; - - /** - * ActionController constructor. - * - * @throws \SP\Core\Exceptions\SPException - */ - public function __construct() - { - $this->Plugin = new AuthenticatorPlugin(); - - PluginDataStore::load($this->Plugin); - - $this->init(); - } - - /** - * Realizar la acción solicitada en la la petición HTTP - * - * @throws \InvalidArgumentException - * @throws \SP\Core\Exceptions\SPException - */ - public function doAction() - { - try { - switch ($this->actionId) { - case ActionController::ACTION_TWOFA_SAVE: - $this->save(); - break; - case ActionController::ACTION_TWOFA_CHECKCODE: - $this->checkCode(); - break; - default: - $this->invalidAction(); - } - } catch (\Exception $e) { - $this->JsonResponse->setDescription($e->getMessage()); - Json::returnJson($this->JsonResponse); - } - } - - /** - * Guardar los datos del plugin - * - * @throws \SP\Core\Exceptions\SPException - * @throws \InvalidArgumentException - * @throws \SP\Core\Exceptions\InvalidClassException - */ - protected function save() - { - $pin = Request::analyze('security_pin'); - $twofa_enabled = Request::analyze('security_2faenabled', 0, false, 1); - - $AuthenticatorData = Session::getUserData(); - - $twoFa = new Authenticator($this->itemId, CoreSession::getUserData()->getUserLogin(), $AuthenticatorData->getIV()); - - if (!$twoFa->verifyKey($pin)) { - $this->JsonResponse->setDescription(_t('authenticator', 'Código incorrecto')); - Json::returnJson($this->JsonResponse); - } - - if (Checks::demoIsEnabled()) { - $this->JsonResponse->setDescription(_t('authenticator', 'Ey, esto es una DEMO!!')); - Json::returnJson($this->JsonResponse); - } - - $data = $this->Plugin->getData(); - - if ($twofa_enabled) { - /** @var AuthenticatorData $AuthenticatorData */ - $AuthenticatorData->setUserId($this->itemId); - $AuthenticatorData->setTwofaEnabled($twofa_enabled); - $AuthenticatorData->setExpireDays(Request::analyze('expiredays', 0)); - $AuthenticatorData->setDate(time()); - - try { - $AuthenticatorData->setRecoveryCodes($this->generateRecoveryCodes()); - } catch (EnvironmentIsBrokenException $e) { - debugLog($e->getMessage()); - } - - $data[$this->itemId] = $AuthenticatorData; - } elseif (!$twofa_enabled) { - unset($data[$this->itemId]); - } - - $this->savePluginUserData($AuthenticatorData); - - $PluginData = new PluginData(); - $PluginData->setPluginName($this->Plugin->getName()); - $PluginData->setPluginEnabled(1); - $PluginData->setPluginData(serialize($data)); - - Plugin::getItem($PluginData)->update(); - - $this->JsonResponse->setStatus(0); - $this->JsonResponse->setDescription(_t('authenticator', 'Preferencias actualizadas')); - - Json::returnJson($this->JsonResponse); - } - - /** - * Generar códigos de recuperación - * - * @return array - * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException - */ - protected function generateRecoveryCodes() - { - $codes = []; - $i = 1; - - do { - $codes[] = Util::generateRandomBytes(10); - $i++; - } while ($i <= 10); - - return $codes; - } - - /** - * Guardar datos del Plugin - * - * @param AuthenticatorData $AuthenticatorData - * @return bool - */ - protected function savePluginUserData(AuthenticatorData $AuthenticatorData) - { - $data = $this->Plugin->getData(); - $data[$AuthenticatorData->getUserId()] = $AuthenticatorData; - - $PluginData = new PluginData(); - $PluginData->setPluginName($this->Plugin->getName()); - $PluginData->setPluginEnabled(1); - $PluginData->setPluginData(serialize($data)); - - try { - Plugin::getItem($PluginData)->update(); - } catch (SPException $e) { - return false; - } - - return true; - } - - /** - * Comprobar el código 2FA - * - * @throws \InvalidArgumentException - * @throws \SP\Core\Exceptions\SPException - */ - protected function checkCode() - { - $userId = Request::analyze('itemId', 0); - $pin = Request::analyze('security_pin'); - $codeReset = Request::analyze('code_reset', false, false, true); - - // Buscar al usuario en los datos del plugin - /** @var AuthenticatorData $AuthenticatorData */ - $AuthenticatorData = ArrayUtil::searchInObject($this->Plugin->getData(), 'userId', $userId, new AuthenticatorData()); - - if (strlen($pin) === 20 && $this->useRecoveryCode($AuthenticatorData, $pin)) { - Session::setTwoFApass(true); - CoreSession::setAuthCompleted(true); - - $this->JsonResponse->setDescription(_t('authenticator', 'Código correcto')); - $this->JsonResponse->setStatus(0); - - Json::returnJson($this->JsonResponse); - } - - if ($codeReset && $this->sendResetEmail($AuthenticatorData)) { - Session::setTwoFApass(false); - CoreSession::setAuthCompleted(false); - - $this->JsonResponse->setDescription(_t('authenticator', 'Email de recuperación enviado')); - $this->JsonResponse->setStatus(0); - - Json::returnJson($this->JsonResponse); - } - - $TwoFa = new Authenticator($userId, CoreSession::getUserData()->getUserLogin(), $AuthenticatorData->getIV()); - - if ($userId - && $pin - && $TwoFa->verifyKey($pin) - ) { - Session::setTwoFApass(true); - CoreSession::setAuthCompleted(true); - - $this->JsonResponse->setDescription(_t('authenticator', 'Código correcto')); - $this->JsonResponse->setStatus(0); - } else { - Session::setTwoFApass(false); - CoreSession::setAuthCompleted(false); - - $this->JsonResponse->setDescription(_t('authenticator', 'Código incorrecto')); - } - - Json::returnJson($this->JsonResponse); - } - - /** - * Envial email con código de recuperación - * - * @param AuthenticatorData $AuthenticatorData - * @return bool - */ - protected function sendResetEmail(AuthenticatorData $AuthenticatorData) - { - $email = CoreSession::getUserData()->getUserEmail(); - - if (!empty($email)) { - - $code = $this->pickRecoveryCode($AuthenticatorData); - - if ($code !== false) { - $LogMessage = new LogMessage(); - $LogMessage->setAction(_t('authenticator', 'Recuperación de Código 2FA')); - $LogMessage->addDescriptionHtml(_t('authenticator', 'Se ha solicitado un código de recuperación para 2FA.')); - $LogMessage->addDescriptionLine(); - $LogMessage->addDescription(sprintf(_t('authenticator', 'El código de recuperación es: %s'), $code)); - - return Email::sendEmail($LogMessage, $email); - } - } - - return false; - } - - /** - * Devolver un código de recuperación - * - * @param AuthenticatorData $AuthenticatorData - * @return mixed - */ - protected function pickRecoveryCode(AuthenticatorData $AuthenticatorData) - { - if ($AuthenticatorData->getLastRecoveryTime() === 0) { - try { - $codes = $this->generateRecoveryCodes(); - } catch (EnvironmentIsBrokenException $e) { - debugLog($e->getMessage()); - - return false; - } - - $AuthenticatorData->setRecoveryCodes($codes); - $AuthenticatorData->setLastRecoveryTime(time()); - - if ($this->savePluginUserData($AuthenticatorData) === false) { - return false; - } - } else { - $codes = $AuthenticatorData->getRecoveryCodes(); - } - - $numCodes = count($codes); - - if ($numCodes > 0) { - return $codes[$numCodes - 1]; - } - - return false; - } - - /** - * Usar un código de recuperación y deshabilitar 2FA - * - * @param AuthenticatorData $AuthenticatorData - * @param $code - * @return bool|string - */ - protected function useRecoveryCode(AuthenticatorData $AuthenticatorData, $code) - { - $codes = $AuthenticatorData->getRecoveryCodes(); - - if ($key = array_search($code, $codes) !== false) { - - unset($codes[$key]); - - $AuthenticatorData->setTwofaEnabled(false); - $AuthenticatorData->setRecoveryCodes($codes); - $AuthenticatorData->setLastRecoveryTime(time()); - - return $this->savePluginUserData($AuthenticatorData); - } - - return false; - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/Authenticator.class.php b/inc/Plugins/Authenticator/Authenticator.class.php deleted file mode 100644 index fec709a0..00000000 --- a/inc/Plugins/Authenticator/Authenticator.class.php +++ /dev/null @@ -1,169 +0,0 @@ -. - */ - -namespace Plugins\Authenticator; - -use Exts\Base2n; -use SP\Core\Exceptions\SPException; -use SP\Mgmt\Users\UserPass; -use SP\Util\Util; - -defined('APP_ROOT') || die(); - -/** - * Class Auth2FA - * - * @package SP\Auth - */ -class Authenticator -{ - /** - * @var int - */ - private $timestamp = 0; - /** - * @var string - */ - private $initializationKey = ''; - /** - * @var string - */ - private $totp = ''; - /** - * @var int - */ - private $userId = 0; - /** - * @var string - */ - private $userLogin = ''; - - /** - * @param int $userId El Id de usuario - * @param string $userLogin El login de usuario - * @param string $IV - * @throws \InvalidArgumentException - */ - public function __construct($userId, $userLogin = null, $IV = null) - { - $this->userId = $userId; - $this->userLogin = $userLogin; - $this->initializationKey = $this->genUserInitializationKey($IV); - } - - /** - * Generar una clave de inicialización codificada en Base32 - * - * @param string $IV - * @return string - * @throws \InvalidArgumentException - */ - private function genUserInitializationKey($IV = null) - { - $userIV = $IV === null ? UserPass::getUserIVById($this->userId) : $IV; - $base32 = new Base2n(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', false, true, true); - - return substr($base32->encode($userIV), 0, 16); - } - - /** - * @param int $userId - */ - public function setUserId($userId) - { - $this->userId = $userId; - } - - /** - * @param string $userLogin - */ - public function setUserLogin($userLogin) - { - $this->userLogin = $userLogin; - } - - /** - * Verificar el código de 2FA - * - * @param $key - * @return bool - * @throws \Exception - */ - public function verifyKey($key) - { - return Google2FA::verify_key($this->initializationKey, $key); - } - - /** - * Devolver el código QR de la peticíón HTTP en base64 - * - * @return bool|string - */ - public function getUserQRCode() - { - try { - $data = Util::getDataFromUrl($this->getUserQRUrl()); - return base64_encode($data); - } catch (SPException $e) { - return false; - } - } - - /** - * Devolver la cadena con la URL para solicitar el código QR - * - * @return string - */ - public function getUserQRUrl() - { - $qrUrl = 'https://www.google.com/chart?chs=150x150&chld=M|0&cht=qr&chl='; - $qrUrl .= urlencode('otpauth://totp/sysPass:syspass/' . $this->userLogin . '?secret=' . $this->initializationKey . '&issuer=sysPass'); - - return $qrUrl; - } - - /** - * Comprobar el token del usuario - * - * @param int $userToken EL código del usuario - * @return bool - * @throws \Exception - */ - public function checkUserToken($userToken) - { - $timeStamp = Google2FA::get_timestamp(); - $secretkey = Google2FA::base32_decode($this->initializationKey); - $totp = Google2FA::oath_totp($secretkey, $timeStamp); - - return ($totp === $userToken); - } - - /** - * @return string - */ - public function getInitializationKey() - { - return $this->initializationKey; - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/AuthenticatorData.class.php b/inc/Plugins/Authenticator/AuthenticatorData.class.php deleted file mode 100644 index cdaa1704..00000000 --- a/inc/Plugins/Authenticator/AuthenticatorData.class.php +++ /dev/null @@ -1,184 +0,0 @@ -. - */ - -namespace Plugins\Authenticator; - -/** - * Class AuthenticatorData - * - * @package Plugins\Authenticator - */ -class AuthenticatorData -{ - /** - * Id de usuario - * - * @var - */ - public $userId; - /** - * Si está habilitado 2FA - * - * @var int - */ - public $twofaEnabled = 0; - /** - * Fecha de activación - * - * @var int - */ - public $date; - /** - * Días de caducidad - * - * @var int - */ - public $expireDays; - /** - * Vector de inicialización - * - * @var string - */ - public $IV; - /** - * @var array - */ - public $recoveryCodes = []; - /** - * @var int - */ - public $lastRecoveryTime = 0; - - /** - * @return mixed - */ - public function getUserId() - { - return (int)$this->userId; - } - - /** - * @param mixed $userId - */ - public function setUserId($userId) - { - $this->userId = (int)$userId; - } - - /** - * @return bool - */ - public function isTwofaEnabled() - { - return (bool)$this->twofaEnabled; - } - - /** - * @param int $twofaEnabled - */ - public function setTwofaEnabled($twofaEnabled) - { - $this->twofaEnabled = (int)$twofaEnabled; - } - - /** - * @return int - */ - public function getDate() - { - return $this->date; - } - - /** - * @param int $date - */ - public function setDate($date) - { - $this->date = $date; - } - - /** - * @return int - */ - public function getExpireDays() - { - return $this->expireDays; - } - - /** - * @param int $expireDays - */ - public function setExpireDays($expireDays) - { - $this->expireDays = $expireDays; - } - - /** - * @return string - */ - public function getIV() - { - return $this->IV; - } - - /** - * @param string $IV - */ - public function setIV($IV) - { - $this->IV = $IV; - } - - /** - * @return array - */ - public function getRecoveryCodes() - { - return $this->recoveryCodes; - } - - /** - * @param array $recoveryCodes - */ - public function setRecoveryCodes(array $recoveryCodes) - { - $this->recoveryCodes = $recoveryCodes; - } - - /** - * @return int - */ - public function getLastRecoveryTime() - { - return $this->lastRecoveryTime; - } - - /** - * @param int $lastRecoveryTime - */ - public function setLastRecoveryTime($lastRecoveryTime) - { - $this->lastRecoveryTime = $lastRecoveryTime; - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php b/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php deleted file mode 100644 index f1f636fa..00000000 --- a/inc/Plugins/Authenticator/AuthenticatorPlugin.class.php +++ /dev/null @@ -1,172 +0,0 @@ -. - */ - -namespace Plugins\Authenticator; - -use SP\Core\DiFactory; -use SP\Core\Plugin\PluginBase; -use SplSubject; - -/** - * Class Plugin - * - * @package Plugins\Authenticator - */ -class AuthenticatorPlugin extends PluginBase -{ - const PLUGIN_NAME = 'Authenticator'; - - /** - * Receive update from subject - * - * @link http://php.net/manual/en/splobserver.update.php - * @param SplSubject $subject

- * The SplSubject notifying the observer of an update. - *

- * @return void - * @since 5.1.0 - */ - public function update(SplSubject $subject) - { - } - - /** - * Inicialización del plugin - */ - public function init() - { - if (!is_array($this->data)) { - $this->data = []; - } - - $this->base = __DIR__; - $this->themeDir = __DIR__ . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . DiFactory::getTheme()->getThemeName(); - - $this->setLocales(); - } - - /** - * Evento de actualización - * - * @param string $event Nombre del evento - * @param mixed $object - * @throws \SP\Core\Exceptions\FileNotFoundException - * @throws \SP\Core\Exceptions\SPException - */ - public function updateEvent($event, $object) - { - switch ($event){ - case 'user.preferences': - $Controller = new PreferencesController($object, $this); - $Controller->getSecurityTab(); - break; - case 'main.prelogin.2fa': - $Controller = new LoginController($this); - $Controller->get2FA($object); - break; - case 'login.preferences': - $Controller = new LoginController($this); - $Controller->checkLogin(); - break; - } - } - - /** - * Devuelve los eventos que implementa el observador - * - * @return array - */ - public function getEvents() - { - return ['user.preferences', 'main.prelogin.2fa', 'login.preferences']; - } - - /** - * Devuelve los recursos JS y CSS necesarios para el plugin - * - * @return array - */ - public function getJsResources() - { - return ['plugin.min.js']; - } - - /** - * Devuelve el autor del plugin - * - * @return string - */ - public function getAuthor() - { - return 'Rubén D.'; - } - - /** - * Devuelve la versión del plugin - * - * @return array - */ - public function getVersion() - { - return [1, 1]; - } - - /** - * Devuelve la versión compatible de sysPass - * - * @return array - */ - public function getCompatibleVersion() - { - return [2, 0]; - } - - /** - * Devuelve los recursos CSS necesarios para el plugin - * - * @return array - */ - public function getCssResources() - { - return []; - } - - /** - * Devuelve el nombre del plugin - * - * @return string - */ - public function getName() - { - return self::PLUGIN_NAME; - } - - /** - * @return array|AuthenticatorData[] - */ - public function getData() - { - return (array)parent::getData(); - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/Google2FA.class.php b/inc/Plugins/Authenticator/Google2FA.class.php deleted file mode 100644 index 9b047a36..00000000 --- a/inc/Plugins/Authenticator/Google2FA.class.php +++ /dev/null @@ -1,215 +0,0 @@ -. - */ - -/** - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * PHP Google two-factor authentication module. - * - * See http://www.idontplaydarts.com/2011/07/google-totp-two-factor-authentication-for-php/ - * for more details - * - * @author Phil - **/ - -namespace Plugins\Authenticator; - -/** - * Class Google2FA - * - * @package SP\Auth - */ -class Google2FA -{ - /** - * Interval between key regeneration - */ - const keyRegeneration = 30; - /** - * Length of the Token generated - */ - const otpLength = 6; - - /** - * Lookup needed for Base32 encoding - * - * @var array - */ - private static $lut = [ // Lookup needed for Base32 encoding - 'A' => 0, 'B' => 1, - 'C' => 2, 'D' => 3, - 'E' => 4, 'F' => 5, - 'G' => 6, 'H' => 7, - 'I' => 8, 'J' => 9, - 'K' => 10, 'L' => 11, - 'M' => 12, 'N' => 13, - 'O' => 14, 'P' => 15, - 'Q' => 16, 'R' => 17, - 'S' => 18, 'T' => 19, - 'U' => 20, 'V' => 21, - 'W' => 22, 'X' => 23, - 'Y' => 24, 'Z' => 25, - '2' => 26, '3' => 27, - '4' => 28, '5' => 29, - '6' => 30, '7' => 31 - ]; - - /** - * Generates a 16 digit secret key in base32 format - * - * @param int $length - * @return string - */ - public static function generate_secret_key($length = 16) - { - $b32 = '234567QWERTYUIOPASDFGHJKLZXCVBNM'; - $s = ''; - - for ($i = 0; $i < $length; $i++) { - $s .= $b32[mt_rand(0, 31)]; - } - - return $s; - } - - /** - * Verifys a user inputted key against the current timestamp. Checks $window - * keys either side of the timestamp. - * - * @param string $b32seed - * @param string $key - User specified key - * @param integer $window - * @param boolean $useTimeStamp - * @return boolean - * @throws \Exception - **/ - public static function verify_key($b32seed, $key, $window = 4, $useTimeStamp = true) - { - - $timeStamp = ($useTimeStamp !== true) ? (int)$useTimeStamp : self::get_timestamp(); - - $binarySeed = self::base32_decode($b32seed); - - for ($ts = $timeStamp - $window; $ts <= $timeStamp + $window; $ts++) { - if (self::oath_totp($binarySeed, $ts) == $key) { - return true; - } - } - - return false; - - } - - /** - * Returns the current Unix Timestamp devided by the keyRegeneration - * period. - * - * @return integer - **/ - public static function get_timestamp() - { - return floor(microtime(true) / self::keyRegeneration); - } - - /** - * Decodes a base32 string into a binary string. - **/ - public static function base32_decode($b32) - { - - $b32 = strtoupper($b32); - - if (!preg_match('/^[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]+$/', $b32, $match)) { - throw new \Exception('Invalid characters in the base32 string.'); - } - - $l = strlen($b32); - $n = 0; - $j = 0; - $binary = ''; - - for ($i = 0; $i < $l; $i++) { - $n <<= 5; // Move buffer left by 5 to make room - $n += self::$lut[$b32[$i]]; // Add value into buffer - $j += 5; // Keep track of number of bits in buffer - - if ($j >= 8) { - $j -= 8; - $binary .= chr(($n & (0xFF << $j)) >> $j); - } - } - - return $binary; - } - - /** - * Takes the secret key and the timestamp and returns the one time - * password. - * - * @param string $key - Secret key in binary form. - * @param int $counter - Timestamp as returned by get_timestamp. - * @return string - * @throws \Exception - */ - public static function oath_totp($key, $counter) - { - if (strlen($key) < 8) { - throw new \Exception('Secret key is too short. Must be at least 16 base 32 characters'); - } - - $bin_counter = pack('N*', 0) . pack('N*', $counter); // Counter must be 64-bit int - $hash = hash_hmac('sha1', $bin_counter, $key, true); - - return str_pad(self::oath_truncate($hash), self::otpLength, '0', STR_PAD_LEFT); - } - - /** - * Extracts the OTP from the SHA1 hash. - * - * @param string $hash - * @return integer - **/ - public static function oath_truncate($hash) - { - $offset = ord($hash[19]) & 0xf; - - return ( - ((ord($hash[$offset + 0]) & 0x7f) << 24) | - ((ord($hash[$offset + 1]) & 0xff) << 16) | - ((ord($hash[$offset + 2]) & 0xff) << 8) | - (ord($hash[$offset + 3]) & 0xff) - ) % pow(10, self::otpLength); - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/LoginController.class.php b/inc/Plugins/Authenticator/LoginController.class.php deleted file mode 100644 index e0a7891f..00000000 --- a/inc/Plugins/Authenticator/LoginController.class.php +++ /dev/null @@ -1,169 +0,0 @@ -. - */ - -namespace Plugins\Authenticator; - -use SP\Controller\ControllerBase; -use SP\Core\Init; -use SP\Core\Messages\NoticeMessage; -use SP\Core\Plugin\PluginBase; -use SP\Core\Session as CoreSession; -use SP\Http\JsonResponse; -use SP\Http\Request; -use SP\Mgmt\Notices\Notice; -use SP\Util\Json; - -/** - * Class LoginController - * - * @package Plugins\Authenticator - */ -class LoginController -{ - const WARNING_TIME = 432000; - - /** - * @var PluginBase - */ - protected $Plugin; - - /** - * Controller constructor. - * - * @param PluginBase $Plugin - */ - public function __construct(PluginBase $Plugin) - { - $this->Plugin = $Plugin; - } - - /** - * Obtener los datos para el interface de autentificación en 2 pasos - * - * @param ControllerBase $Controller - * @throws \SP\Core\Exceptions\FileNotFoundException - * @throws \SP\Core\Exceptions\SPException - * @throws \SP\Core\Exceptions\InvalidClassException - */ - public function get2FA(ControllerBase $Controller) - { - $Controller->view->addTemplate('body-header'); - - if (Request::analyze('f', 0) === 1) { - $base = $this->Plugin->getThemeDir() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'main'; - - $Controller->view->addTemplate('login-2fa', $base); - - $Controller->view->assign('action', Request::analyze('a')); - $Controller->view->assign('userId', Request::analyze('i', 0)); - $Controller->view->assign('time', Request::analyze('t', 0)); - - $Controller->view->assign('actionId', ActionController::ACTION_TWOFA_CHECKCODE); - - $this->checkExpireTime(); - } else { - $Controller->showError(ControllerBase::ERR_UNAVAILABLE, false); - } - - $Controller->view->addTemplate('body-footer'); - $Controller->view->addTemplate('body-end'); - - $Controller->view(); - exit(); - } - - /** - * Comprobar la caducidad del código - * - * @throws \SP\Core\Exceptions\SPException - * @throws \SP\Core\Exceptions\InvalidClassException - */ - protected function checkExpireTime() - { - /** @var AuthenticatorData[] $data */ - $data = $this->Plugin->getData(); - - $userId = Request::analyze('i', 0); - - if (!isset($data[$userId]) || empty($data[$userId]->getExpireDays())) { - return; - } - - if (count(Notice::getItem()->getByUserCurrentDate()) > 0) { - return; - } - - $expireTime = $data[$userId]->getDate() + ($data[$userId]->getExpireDays() * 86400); - $timeRemaining = $expireTime - time(); - - $NoticeData = Notice::getItem()->getItemData(); - $NoticeData->setNoticeComponent($this->Plugin->getName()); - $NoticeData->setNoticeUserId($userId); - $NoticeData->setNoticeType(_t('authenticator', 'Aviso Caducidad')); - - $Message = new NoticeMessage(); - - if ($timeRemaining <= self::WARNING_TIME) { - $Message->addDescription(sprintf(_t('authenticator', 'El código 2FA se ha de restablecer en %d días'), $timeRemaining / 86400)); - - $NoticeData->setNoticeDescription($Message); - - Notice::getItem($NoticeData)->add(); - } elseif (time() > $expireTime) { - $Message->addDescription(_t('authenticator', 'El código 2FA ha caducado. Es necesario restablecerlo desde las preferencias')); - - $NoticeData->setNoticeDescription($Message); - - Notice::getItem($NoticeData)->add(); - } - } - - /** - * Comprobar 2FA en el login - * - * @throws \SP\Core\Exceptions\SPException - */ - public function checkLogin() - { - /** @var AuthenticatorData[] $data */ - $data = $this->Plugin->getData(); - - $userId = CoreSession::getUserData()->getUserId(); - - if (isset($data[$userId]) && $data[$userId]->isTwofaEnabled()) { - Session::setTwoFApass(false); - CoreSession::setAuthCompleted(false); - - $data = ['url' => Init::$WEBURI . '/index.php?a=2fa&i=' . $userId . '&t=' . time() . '&f=1']; - - $JsonResponse = new JsonResponse(); - $JsonResponse->setData($data); - $JsonResponse->setStatus(0); - - Json::returnJson($JsonResponse); - } else { - Session::setTwoFApass(true); - } - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/PreferencesController.class.php b/inc/Plugins/Authenticator/PreferencesController.class.php deleted file mode 100644 index 07fd0c2b..00000000 --- a/inc/Plugins/Authenticator/PreferencesController.class.php +++ /dev/null @@ -1,103 +0,0 @@ -. - */ - -namespace Plugins\Authenticator; - -use InvalidArgumentException; -use SP\Controller\TabControllerBase; -use SP\Core\OldCrypt; -use SP\Core\Plugin\PluginBase; -use SP\Core\Plugin\PluginInterface; -use SP\Util\ArrayUtil; -use SP\Util\Util; - -/** - * Class Controller - * - * @package Plugins\Authenticator - */ -class PreferencesController -{ - /** - * @var TabControllerBase - */ - protected $Controller; - /** - * @var PluginBase - */ - protected $Plugin; - - /** - * Controller constructor. - * - * @param TabControllerBase $Controller - * @param PluginInterface $Plugin - */ - public function __construct(TabControllerBase $Controller, PluginInterface $Plugin) - { - $this->Controller = $Controller; - $this->Plugin = $Plugin; - } - - /** - * Obtener la pestaña de seguridad - */ - public function getSecurityTab() - { - $base = $this->Plugin->getThemeDir() . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'userpreferences'; - - // Datos del usuario de la sesión - $UserData = $this->Controller->getUserData(); - - // Buscar al usuario en los datos del plugin - /** @var AuthenticatorData $AuthenticatorData */ - $AuthenticatorData = ArrayUtil::searchInObject($this->Plugin->getData(), 'userId', $UserData->getUserId(), new AuthenticatorData()); - - $this->Controller->view->addTemplate('preferences-security', $base); - - try { - $IV = null; - - if (!$AuthenticatorData->isTwofaEnabled()) { - $IV = Util::generateRandomBytes(); - $AuthenticatorData->setIV($IV); - } else { - $IV = $AuthenticatorData->getIV(); - } - - Session::setUserData($AuthenticatorData); - - $twoFa = new Authenticator($UserData->getUserId(), $UserData->getUserLogin(), $IV); - - $this->Controller->view->assign('qrCode', !$AuthenticatorData->isTwofaEnabled() ? $twoFa->getUserQRCode() : ''); - $this->Controller->view->assign('userId', $UserData->getUserId()); - $this->Controller->view->assign('chk2FAEnabled', $AuthenticatorData->isTwofaEnabled()); - $this->Controller->view->assign('expireDays', $AuthenticatorData->getExpireDays()); - - $this->Controller->view->assign('tabIndex', $this->Controller->addTab(_t('authenticator', 'Seguridad')), 'security'); - $this->Controller->view->assign('actionId', ActionController::ACTION_TWOFA_SAVE, 'security'); - } catch (InvalidArgumentException $e) { - } - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/Session.class.php b/inc/Plugins/Authenticator/Session.class.php deleted file mode 100644 index d0bd441f..00000000 --- a/inc/Plugins/Authenticator/Session.class.php +++ /dev/null @@ -1,82 +0,0 @@ -. - */ - -/** - * Created by PhpStorm. - * User: rdb - * Date: 4/01/17 - * Time: 8:32 - */ - -namespace Plugins\Authenticator; - -use SP\Core\Session as CoreSession; - -/** - * Class Session - * - * @package Plugins\Authenticator - */ -class Session -{ - /** - * Establecer el estado de 2FA del usuario - * - * @param bool $pass - */ - public static function setTwoFApass($pass) - { - CoreSession::setPluginKey(AuthenticatorPlugin::PLUGIN_NAME, 'twofapass', $pass); - } - - /** - * Devolver el estado de 2FA del usuario - * - * @return bool - */ - public static function getTwoFApass() - { - return CoreSession::getPluginKey(AuthenticatorPlugin::PLUGIN_NAME, 'twofapass'); - } - - /** - * Establecer los datos del usuario - * - * @param AuthenticatorData $data - */ - public static function setUserData(AuthenticatorData $data) - { - CoreSession::setPluginKey(AuthenticatorPlugin::PLUGIN_NAME, 'userdata', $data); - } - - /** - * Devolver los datos del usuario - * - * @return AuthenticatorData - */ - public static function getUserData() - { - return CoreSession::getPluginKey(AuthenticatorPlugin::PLUGIN_NAME, 'userdata'); - } -} \ No newline at end of file diff --git a/inc/Plugins/Authenticator/ajax/ajax_actions.php b/inc/Plugins/Authenticator/ajax/ajax_actions.php deleted file mode 100644 index dc5ca813..00000000 --- a/inc/Plugins/Authenticator/ajax/ajax_actions.php +++ /dev/null @@ -1,35 +0,0 @@ -. - */ - -use Plugins\Authenticator\ActionController; -use SP\Http\Request; - -define('APP_ROOT', '../../../..'); - -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('POST'); - -$Controller = new ActionController(); -$Controller->doAction(); \ No newline at end of file diff --git a/inc/Plugins/Authenticator/js/plugin.js b/inc/Plugins/Authenticator/js/plugin.js deleted file mode 100644 index 81e98a21..00000000 --- a/inc/Plugins/Authenticator/js/plugin.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * sysPass - * - * @author nuxsmin - * @link http://syspass.org - * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org - * - * This file is part of sysPass. - * - * sysPass is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * sysPass is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with sysPass. If not, see . - */ - -sysPass.Plugin.Authenticator = function (Common) { - "use strict"; - - var log = Common.log; - var base = "/inc/Plugins/Authenticator"; - - var twofa = { - check: function ($obj) { - log.info("Authenticator:twofa:check"); - - var opts = Common.appRequests().getRequestOpts(); - opts.url = base + "/ajax/ajax_actions.php"; - opts.data = $obj.serialize(); - - Common.appRequests().getActionCall(opts, function (json) { - Common.msg.out(json); - - if (json.status == 0) { - setTimeout(function () { - Common.redirect("index.php"); - }, 1000); - } - }); - }, - save: function ($obj) { - log.info("Authenticator:twofa:save"); - - var opts = Common.appRequests().getRequestOpts(); - opts.url = base + "/ajax/ajax_actions.php"; - opts.data = $obj.serialize(); - - Common.appRequests().getActionCall(opts, function (json) { - Common.msg.out(json); - - if (json.status === 0) { - Common.appActions().doAction({ - actionId: $obj.data("nextaction-id"), - itemId: $obj.data("activetab") - }); - } - }); - } - }; - - var init = function () { - - }; - - init(); - - return { - twofa: twofa - }; -}; diff --git a/inc/Plugins/Authenticator/js/plugin.min.js b/inc/Plugins/Authenticator/js/plugin.min.js deleted file mode 100644 index 78aa8e97..00000000 --- a/inc/Plugins/Authenticator/js/plugin.min.js +++ /dev/null @@ -1,2 +0,0 @@ -sysPass.Plugin.Authenticator=function(b){var d=b.log;return{twofa:{check:function(c){d.info("Authenticator:twofa:check");var a=b.appRequests().getRequestOpts();a.url="/inc/Plugins/Authenticator/ajax/ajax_actions.php";a.data=c.serialize();b.appRequests().getActionCall(a,function(a){b.msg.out(a);0==a.status&&setTimeout(function(){b.redirect("index.php")},1E3)})},save:function(c){d.info("Authenticator:twofa:save");var a=b.appRequests().getRequestOpts();a.url="/inc/Plugins/Authenticator/ajax/ajax_actions.php"; -a.data=c.serialize();b.appRequests().getActionCall(a,function(a){b.msg.out(a);0===a.status&&b.appActions().doAction({actionId:c.data("nextaction-id"),itemId:c.data("activetab")})})}}}}; diff --git a/inc/Plugins/Authenticator/locales/ca_ES/LC_MESSAGES/authenticator.mo b/inc/Plugins/Authenticator/locales/ca_ES/LC_MESSAGES/authenticator.mo deleted file mode 100644 index 09f3aaf8..00000000 Binary files a/inc/Plugins/Authenticator/locales/ca_ES/LC_MESSAGES/authenticator.mo and /dev/null differ diff --git a/inc/Plugins/Authenticator/locales/ca_ES/LC_MESSAGES/authenticator.po b/inc/Plugins/Authenticator/locales/ca_ES/LC_MESSAGES/authenticator.po deleted file mode 100644 index c0cd9b44..00000000 --- a/inc/Plugins/Authenticator/locales/ca_ES/LC_MESSAGES/authenticator.po +++ /dev/null @@ -1,128 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: sysPass\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-03 22:10+0100\n" -"PO-Revision-Date: 2017-02-03 22:10+0100\n" -"Last-Translator: nuxsmin \n" -"Language-Team: \n" -"Language: ca_ES\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.10\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-Basepath: .\n" -"X-Poedit-KeywordsList: _t:2\n" -"X-Poedit-SearchPath-0: ../../..\n" - -#: ../../../ActionController.class.php:112 -#: ../../../ActionController.class.php:178 -msgid "Código incorrecto" -msgstr "Codi incorrecte" - -#: ../../../ActionController.class.php:117 -msgid "Ey, esto es una DEMO!!" -msgstr "Ey, això és una DEMO!!" - -#: ../../../ActionController.class.php:143 -msgid "Preferencias actualizadas" -msgstr "Preferències actualitzades" - -#: ../../../ActionController.class.php:172 -msgid "Código correcto" -msgstr "Codi correcte" - -#: ../../../LoginController.class.php:126 -#, fuzzy -msgid "Aviso Caducidad" -msgstr "Data Edició" - -#: ../../../LoginController.class.php:131 -#, php-format -msgid "El código 2FA se ha de restablecer en %d días" -msgstr "El codi 2FA s'ha de restablir en %d dies." - -#: ../../../LoginController.class.php:137 -msgid "" -"El código 2FA ha caducado. Es necesario restablecerlo desde las preferencias" -msgstr "" -"El codi 2FA ha caducat. Es necessari restablir-ho des de les preferències." - -#: ../../../PreferencesController.class.php:97 -msgid "Seguridad" -msgstr "Seguretat" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:7 -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:40 -msgid "Autentificación en 2 pasos" -msgstr "Autenticació en 2 passos" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:13 -msgid "Introducir código" -msgstr "Introduir codi" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:27 -msgid "Volver a iniciar sesión" -msgstr "Tornar a iniciar sessió" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:28 -msgid "Volver" -msgstr "Tornar" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:32 -msgid "Acceder" -msgstr "Accedir" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:34 -msgid "Solicitar" -msgstr "Sol·licitar" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:29 -msgid "Autentificación" -msgstr "Autenticació" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:45 -msgid "" -"Habilita la autentificación en 2 pasos que requiere de la introducción de un " -"token generado por una aplicación como Google Authenticator." -msgstr "" -"Habilita l'autenticació en 2 passos que requereix de la introducció d'un " -"token generat per una aplicació com Google Authenticator." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:49 -msgid "" -"Escanee el código QR proporcionado y a continuación introduzca la clave de 6 " -"dígitos." -msgstr "" -"Escanegi el codi QR proporcionat i a continuació introdueixi la clau de 6 " -"dígits." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:58 -msgid "Activar" -msgstr "Activar" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:64 -msgid "Error al obtener el código QR. Inténtelo de nuevo" -msgstr "Error en obtenir el codi QR. Intenti-ho de nou" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:74 -msgid "Código" -msgstr "Codi" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:80 -msgid "" -"Una vez activada, sólo es posible acceder si se dispone del dispositivo " -"generador de códigos asociado." -msgstr "" -"Una vegada activada, només és possible accedir si es disposa del dispositiu " -"generador de codis associat." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:84 -#, fuzzy -msgid "Días Caducidad" -msgstr "Data Edició" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:91 -msgid "Días" -msgstr "Dies" diff --git a/inc/Plugins/Authenticator/locales/de_DE/LC_MESSAGES/authenticator.mo b/inc/Plugins/Authenticator/locales/de_DE/LC_MESSAGES/authenticator.mo deleted file mode 100644 index 2d5380d5..00000000 Binary files a/inc/Plugins/Authenticator/locales/de_DE/LC_MESSAGES/authenticator.mo and /dev/null differ diff --git a/inc/Plugins/Authenticator/locales/de_DE/LC_MESSAGES/authenticator.po b/inc/Plugins/Authenticator/locales/de_DE/LC_MESSAGES/authenticator.po deleted file mode 100644 index 26bb0992..00000000 --- a/inc/Plugins/Authenticator/locales/de_DE/LC_MESSAGES/authenticator.po +++ /dev/null @@ -1,147 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: sysPass\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-16 02:42+0100\n" -"PO-Revision-Date: 2017-08-16 02:42+0100\n" -"Last-Translator: nuxsmin \n" -"Language-Team: \n" -"Language: de_DE\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.10\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-Basepath: .\n" -"X-Poedit-KeywordsList: _t:2\n" -"X-Poedit-SearchPath-0: ../../..\n" - -#: ../../../ActionController.class.php:116 -#: ../../../ActionController.class.php:255 -msgid "Código incorrecto" -msgstr "Falscher Code" - -#: ../../../ActionController.class.php:121 -msgid "Ey, esto es una DEMO!!" -msgstr "Hey, dies ist eine DEMO!!" - -#: ../../../ActionController.class.php:155 -msgid "Preferencias actualizadas" -msgstr "Einstellungen aktualisiert" - -#: ../../../ActionController.class.php:224 -#: ../../../ActionController.class.php:249 -msgid "Código correcto" -msgstr "Code bestätigt" - -#: ../../../ActionController.class.php:234 -msgid "Email de recuperación enviado" -msgstr "" - -#: ../../../ActionController.class.php:277 -msgid "Recuperación de Código 2FA" -msgstr "" - -#: ../../../ActionController.class.php:278 -msgid "Se ha solicitado un código de recuperación para 2FA." -msgstr "" - -#: ../../../ActionController.class.php:280 -#, php-format -msgid "El código de recuperación es: %s" -msgstr "" - -#: ../../../LoginController.class.php:123 -#, fuzzy -msgid "Aviso Caducidad" -msgstr "Änderungsdatum" - -#: ../../../LoginController.class.php:128 -#, php-format -msgid "El código 2FA se ha de restablecer en %d días" -msgstr "Der 2FA-Code muss innerhalb von %d Tagen zurückgesetzt werden" - -#: ../../../LoginController.class.php:134 -msgid "" -"El código 2FA ha caducado. Es necesario restablecerlo desde las preferencias" -msgstr "" -"Der 2FA Code ist abgelaufen. Du musst es auf der Registerkarte Einstellungen " -"zurücksetzen" - -#: ../../../PreferencesController.class.php:98 -msgid "Seguridad" -msgstr "Sicherheit" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:7 -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:40 -msgid "Autentificación en 2 pasos" -msgstr "Zwei-Faktor Authentifizierung" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:13 -msgid "Introducir código" -msgstr "Code eingeben" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:17 -msgid "Olvidé mi código" -msgstr "" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:30 -msgid "Volver a iniciar sesión" -msgstr "Zurück zur Anmeldung" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:31 -msgid "Volver" -msgstr "Zurück" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:35 -msgid "Acceder" -msgstr "Anmeldung" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:37 -msgid "Solicitar" -msgstr "Anfrage" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:29 -msgid "Autentificación" -msgstr "Authentifizierung" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:45 -msgid "" -"Habilita la autentificación en 2 pasos que requiere de la introducción de un " -"token generado por una aplicación como Google Authenticator." -msgstr "Aktiviert Zwei-Faktor-Authentifizierung" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:49 -msgid "" -"Escanee el código QR proporcionado y a continuación introduzca la clave de 6 " -"dígitos." -msgstr "Scanne den angegebenen QR-Code und gib den sechs stelligen Code ein." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:58 -msgid "Activar" -msgstr "Aktivieren" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:64 -msgid "Error al obtener el código QR. Inténtelo de nuevo" -msgstr "Fehler beim Abrufen des QR-Codes. Bitte erneut versuchen." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:74 -msgid "Código" -msgstr "Code" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:80 -msgid "" -"Una vez activada, sólo es posible acceder si se dispone del dispositivo " -"generador de códigos asociado." -msgstr "" -"Sobald aktiviert, kannst du dich nur mit dem Codegenerator verbundenen Gerät " -"anmelden." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:84 -#, fuzzy -msgid "Días Caducidad" -msgstr "Änderungsdatum" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:91 -msgid "Días" -msgstr "Tage" diff --git a/inc/Plugins/Authenticator/locales/en_US/LC_MESSAGES/authenticator.mo b/inc/Plugins/Authenticator/locales/en_US/LC_MESSAGES/authenticator.mo deleted file mode 100644 index ebf94a85..00000000 Binary files a/inc/Plugins/Authenticator/locales/en_US/LC_MESSAGES/authenticator.mo and /dev/null differ diff --git a/inc/Plugins/Authenticator/locales/en_US/LC_MESSAGES/authenticator.po b/inc/Plugins/Authenticator/locales/en_US/LC_MESSAGES/authenticator.po deleted file mode 100644 index daab6c79..00000000 --- a/inc/Plugins/Authenticator/locales/en_US/LC_MESSAGES/authenticator.po +++ /dev/null @@ -1,145 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Authenticator\n" -"POT-Creation-Date: 2017-08-16 02:43+0100\n" -"PO-Revision-Date: 2017-08-16 02:43+0100\n" -"Last-Translator: nuxsmin \n" -"Language-Team: nuxsmin@syspass.org\n" -"Language: en_US\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.10\n" -"X-Poedit-Basepath: .\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: _t:2\n" -"X-Poedit-SearchPath-0: ../../..\n" - -#: ../../../ActionController.class.php:116 -#: ../../../ActionController.class.php:255 -msgid "Código incorrecto" -msgstr "Wrong code" - -#: ../../../ActionController.class.php:121 -msgid "Ey, esto es una DEMO!!" -msgstr "Ey, this is a DEMO!!" - -#: ../../../ActionController.class.php:155 -msgid "Preferencias actualizadas" -msgstr "Preferences updated" - -#: ../../../ActionController.class.php:224 -#: ../../../ActionController.class.php:249 -msgid "Código correcto" -msgstr "Correct code" - -#: ../../../ActionController.class.php:234 -msgid "Email de recuperación enviado" -msgstr "Recovery email has been sent" - -#: ../../../ActionController.class.php:277 -msgid "Recuperación de Código 2FA" -msgstr "2FA Code Recovery" - -#: ../../../ActionController.class.php:278 -msgid "Se ha solicitado un código de recuperación para 2FA." -msgstr "A 2FA recovery code has been requested." - -#: ../../../ActionController.class.php:280 -#, php-format -msgid "El código de recuperación es: %s" -msgstr "The recovery code is: %s" - -#: ../../../LoginController.class.php:123 -msgid "Aviso Caducidad" -msgstr "Expire Notice" - -#: ../../../LoginController.class.php:128 -#, php-format -msgid "El código 2FA se ha de restablecer en %d días" -msgstr "The 2FA code will need to be reset within %d days" - -#: ../../../LoginController.class.php:134 -msgid "" -"El código 2FA ha caducado. Es necesario restablecerlo desde las preferencias" -msgstr "The 2FA code is expired. You need to reset it on preferences tab" - -#: ../../../PreferencesController.class.php:98 -msgid "Seguridad" -msgstr "Security" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:7 -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:40 -msgid "Autentificación en 2 pasos" -msgstr "Two Factor Authentication" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:13 -msgid "Introducir código" -msgstr "Enter code" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:17 -msgid "Olvidé mi código" -msgstr "Forgot my code" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:30 -msgid "Volver a iniciar sesión" -msgstr "Back to log in" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:31 -msgid "Volver" -msgstr "Back" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:35 -msgid "Acceder" -msgstr "Log in" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:37 -msgid "Solicitar" -msgstr "Request" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:29 -msgid "Autentificación" -msgstr "Authentication" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:45 -msgid "" -"Habilita la autentificación en 2 pasos que requiere de la introducción de un " -"token generado por una aplicación como Google Authenticator." -msgstr "" -"Enables the two factor authentication that requires entering a token that is " -"generated by an application like Google Authenticator." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:49 -msgid "" -"Escanee el código QR proporcionado y a continuación introduzca la clave de 6 " -"dígitos." -msgstr "Please, scan the provided QR code and then enter the 6 digits key." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:58 -msgid "Activar" -msgstr "Enable" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:64 -msgid "Error al obtener el código QR. Inténtelo de nuevo" -msgstr "Error while getting the QR code. Please, try it again" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:74 -msgid "Código" -msgstr "Code" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:80 -msgid "" -"Una vez activada, sólo es posible acceder si se dispone del dispositivo " -"generador de códigos asociado." -msgstr "" -"Once enabled, you wil only be able to log in by using the code generator " -"linked device." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:84 -msgid "Días Caducidad" -msgstr "Expiry Days" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:91 -msgid "Días" -msgstr "Days" diff --git a/inc/Plugins/Authenticator/locales/po_PO/LC_MESSAGES/authenticator.mo b/inc/Plugins/Authenticator/locales/po_PO/LC_MESSAGES/authenticator.mo deleted file mode 100644 index 744ea7cc..00000000 Binary files a/inc/Plugins/Authenticator/locales/po_PO/LC_MESSAGES/authenticator.mo and /dev/null differ diff --git a/inc/Plugins/Authenticator/locales/po_PO/LC_MESSAGES/authenticator.po b/inc/Plugins/Authenticator/locales/po_PO/LC_MESSAGES/authenticator.po deleted file mode 100644 index a4654660..00000000 --- a/inc/Plugins/Authenticator/locales/po_PO/LC_MESSAGES/authenticator.po +++ /dev/null @@ -1,146 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Authenticator\n" -"POT-Creation-Date: 2017-08-16 02:43+0100\n" -"PO-Revision-Date: 2017-08-16 02:43+0100\n" -"Last-Translator: nuxsmin \n" -"Language-Team: language@syspass.org\n" -"Language: en_US\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.10\n" -"X-Poedit-Basepath: .\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: _t:2\n" -"X-Contributors: wojtek\n" -"X-Poedit-SearchPath-0: ../../..\n" - -#: ../../../ActionController.class.php:116 -#: ../../../ActionController.class.php:255 -msgid "Código incorrecto" -msgstr "Zły kod" - -#: ../../../ActionController.class.php:121 -msgid "Ey, esto es una DEMO!!" -msgstr "Ej, to jest demo!!" - -#: ../../../ActionController.class.php:155 -msgid "Preferencias actualizadas" -msgstr "Ustawienia zaktualizowane" - -#: ../../../ActionController.class.php:224 -#: ../../../ActionController.class.php:249 -msgid "Código correcto" -msgstr "Prawidłowy kod" - -#: ../../../ActionController.class.php:234 -msgid "Email de recuperación enviado" -msgstr "" - -#: ../../../ActionController.class.php:277 -msgid "Recuperación de Código 2FA" -msgstr "" - -#: ../../../ActionController.class.php:278 -msgid "Se ha solicitado un código de recuperación para 2FA." -msgstr "" - -#: ../../../ActionController.class.php:280 -#, php-format -msgid "El código de recuperación es: %s" -msgstr "" - -#: ../../../LoginController.class.php:123 -msgid "Aviso Caducidad" -msgstr "Powiadomienie o wygaśnięciu" - -#: ../../../LoginController.class.php:128 -#, php-format -msgid "El código 2FA se ha de restablecer en %d días" -msgstr "2FA kod będzie musiał być zresetowany w ciągu %d dni" - -#: ../../../LoginController.class.php:134 -msgid "" -"El código 2FA ha caducado. Es necesario restablecerlo desde las preferencias" -msgstr "Kod 2FA wygasł. Zresetuj go w zakładce z ustawieniami" - -#: ../../../PreferencesController.class.php:98 -msgid "Seguridad" -msgstr "Bezpieczeństwo" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:7 -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:40 -msgid "Autentificación en 2 pasos" -msgstr "Dwustopniowe logowanie" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:13 -msgid "Introducir código" -msgstr "Wprowadź kod" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:17 -msgid "Olvidé mi código" -msgstr "" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:30 -msgid "Volver a iniciar sesión" -msgstr "Wróć do logowania" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:31 -msgid "Volver" -msgstr "Wróć" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:35 -msgid "Acceder" -msgstr "Logowanie" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:37 -msgid "Solicitar" -msgstr "Żądanie" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:29 -msgid "Autentificación" -msgstr "Poświadczenie" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:45 -msgid "" -"Habilita la autentificación en 2 pasos que requiere de la introducción de un " -"token generado por una aplicación como Google Authenticator." -msgstr "" -"Włącza dwustopniowe logowanie, które wymag podania tokenu generowanego przez " -"aplikację, np. Google Authenticator" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:49 -msgid "" -"Escanee el código QR proporcionado y a continuación introduzca la clave de 6 " -"dígitos." -msgstr "Zeskanuj wyświetlony kod QR i wprowadź 6 cyfr." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:58 -msgid "Activar" -msgstr "Włącz" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:64 -msgid "Error al obtener el código QR. Inténtelo de nuevo" -msgstr "Błąd pobierania kodu QR. Spróbuj ponownie" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:74 -msgid "Código" -msgstr "Kod" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:80 -msgid "" -"Una vez activada, sólo es posible acceder si se dispone del dispositivo " -"generador de códigos asociado." -msgstr "" -"Po włączeniu będziesz mógł się zalogować tylko z użyciem kodu wygenerowanego " -"przez podłączone urządzenie." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:84 -msgid "Días Caducidad" -msgstr "Dni do wygaśnięcia" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:91 -msgid "Días" -msgstr "Dni" diff --git a/inc/Plugins/Authenticator/locales/ru_RU/LC_MESSAGES/authenticator.mo b/inc/Plugins/Authenticator/locales/ru_RU/LC_MESSAGES/authenticator.mo deleted file mode 100644 index 66ca9e9d..00000000 Binary files a/inc/Plugins/Authenticator/locales/ru_RU/LC_MESSAGES/authenticator.mo and /dev/null differ diff --git a/inc/Plugins/Authenticator/locales/ru_RU/LC_MESSAGES/authenticator.po b/inc/Plugins/Authenticator/locales/ru_RU/LC_MESSAGES/authenticator.po deleted file mode 100644 index 9215bfb6..00000000 --- a/inc/Plugins/Authenticator/locales/ru_RU/LC_MESSAGES/authenticator.po +++ /dev/null @@ -1,144 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: sysPass\n" -"POT-Creation-Date: 2017-08-16 02:43+0100\n" -"PO-Revision-Date: \n" -"Last-Translator: nuxsmin \n" -"Language-Team: Alexander Titov,Alex Us\n" -"Language: ru\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.6.10\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-Basepath: .\n" -"X-Poedit-KeywordsList: _t:2\n" -"X-Poedit-SearchPath-0: ../../..\n" - -#: ../../../ActionController.class.php:116 -#: ../../../ActionController.class.php:255 -msgid "Código incorrecto" -msgstr "Неправильный код" - -#: ../../../ActionController.class.php:121 -msgid "Ey, esto es una DEMO!!" -msgstr "Эй, это Демо-версия!!" - -#: ../../../ActionController.class.php:155 -msgid "Preferencias actualizadas" -msgstr "Настройки изменены" - -#: ../../../ActionController.class.php:224 -#: ../../../ActionController.class.php:249 -msgid "Código correcto" -msgstr "Правильный код" - -#: ../../../ActionController.class.php:234 -msgid "Email de recuperación enviado" -msgstr "" - -#: ../../../ActionController.class.php:277 -msgid "Recuperación de Código 2FA" -msgstr "" - -#: ../../../ActionController.class.php:278 -msgid "Se ha solicitado un código de recuperación para 2FA." -msgstr "" - -#: ../../../ActionController.class.php:280 -#, php-format -msgid "El código de recuperación es: %s" -msgstr "" - -#: ../../../LoginController.class.php:123 -#, fuzzy -msgid "Aviso Caducidad" -msgstr "Действует до" - -#: ../../../LoginController.class.php:128 -#, php-format -msgid "El código 2FA se ha de restablecer en %d días" -msgstr "2FA код будет сброшен через %d дней." - -#: ../../../LoginController.class.php:134 -msgid "" -"El código 2FA ha caducado. Es necesario restablecerlo desde las preferencias" -msgstr "2FA код просрочен. Вам нужно сбросить его на странице настроек" - -#: ../../../PreferencesController.class.php:98 -msgid "Seguridad" -msgstr "Безопасность" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:7 -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:40 -msgid "Autentificación en 2 pasos" -msgstr "Двухфакторная аутентификация" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:13 -msgid "Introducir código" -msgstr "Введите код" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:17 -msgid "Olvidé mi código" -msgstr "" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:30 -msgid "Volver a iniciar sesión" -msgstr "Назад ко входу" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:31 -msgid "Volver" -msgstr "Назад" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:35 -msgid "Acceder" -msgstr "Войти" - -#: ../../../themes/material-blue/views/main/login-2fa.inc:37 -msgid "Solicitar" -msgstr "Запрос" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:29 -msgid "Autentificación" -msgstr "Аутентификация" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:45 -msgid "" -"Habilita la autentificación en 2 pasos que requiere de la introducción de un " -"token generado por una aplicación como Google Authenticator." -msgstr "Включает двухфакторную аутентификацию, например Google Authenticator." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:49 -msgid "" -"Escanee el código QR proporcionado y a continuación introduzca la clave de 6 " -"dígitos." -msgstr "Отсканируйте QR-код и затем введите шестизначный пароль." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:58 -msgid "Activar" -msgstr "Активировать" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:64 -msgid "Error al obtener el código QR. Inténtelo de nuevo" -msgstr "Ошибка получения QR-кода. Попробуйте еще раз." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:74 -msgid "Código" -msgstr "Пароль" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:80 -msgid "" -"Una vez activada, sólo es posible acceder si se dispone del dispositivo " -"generador de códigos asociado." -msgstr "" -"После включения, Вы можете получить доступ только при наличии привязанного " -"устройства." - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:84 -#, fuzzy -msgid "Días Caducidad" -msgstr "Действует до" - -#: ../../../themes/material-blue/views/userpreferences/preferences-security.inc:91 -msgid "Días" -msgstr "Дни" diff --git a/inc/Plugins/Authenticator/themes/material-blue/views/main/login-2fa.inc b/inc/Plugins/Authenticator/themes/material-blue/views/main/login-2fa.inc deleted file mode 100644 index bb247c3b..00000000 --- a/inc/Plugins/Authenticator/themes/material-blue/views/main/login-2fa.inc +++ /dev/null @@ -1,42 +0,0 @@ -
-
-
-
- -
- - -
- - - - - - -
- -
- - - -
-
-
-
\ No newline at end of file diff --git a/inc/Plugins/Authenticator/themes/material-blue/views/userpreferences/preferences-security.inc b/inc/Plugins/Authenticator/themes/material-blue/views/userpreferences/preferences-security.inc deleted file mode 100644 index 6e8fa0bc..00000000 --- a/inc/Plugins/Authenticator/themes/material-blue/views/userpreferences/preferences-security.inc +++ /dev/null @@ -1,115 +0,0 @@ -. - */ /** @var $icons \Theme\Icons */ ?> - - -
-
-
- -
- -
- - - - - - - - - -
- -
getIconHelp()->getIcon(); ?>
-
-

- -

- -

- -

-
-
- - -

- QR Code - -

- -

- -
- - -
-
- -
getIconWarning()->getIcon(); ?>
- -
-
- - -
-
- - - - - - -
-
-
    -
  • - -
  • -
-
-
-
\ No newline at end of file diff --git a/inc/themes/material-blue/js/app-theme.js b/inc/themes/material-blue/js/app-theme.js index 24dd9f08..ab6068c2 100644 --- a/inc/themes/material-blue/js/app-theme.js +++ b/inc/themes/material-blue/js/app-theme.js @@ -483,11 +483,16 @@ sysPass.Theme = function (Common) { * @type {{getList: html.getList}} */ var html = { - getList: function (items) { + getList: function (items, icon) { var $ul = $("
    "); var $li = $("
  • "); var $span = $(""); - var icon = "person"; + + if (icon === undefined) { + icon = "person"; + } else { + icon = "" + icon + ""; + } items.forEach(function (value) { var $spanClone = $span.clone(); diff --git a/inc/themes/material-blue/js/app-theme.min.js b/inc/themes/material-blue/js/app-theme.min.js index e2632cb8..9029b820 100644 --- a/inc/themes/material-blue/js/app-theme.min.js +++ b/inc/themes/material-blue/js/app-theme.min.js @@ -1,20 +1,20 @@ -var $jscomp={scope:{},findInternal:function(a,f,c){a instanceof String&&(a=String(a));for(var g=a.length,h=0;h"); -a.passwordData.complexity.numbers&&(d+="1234567890");a.passwordData.complexity.chars&&(d+="abcdefghijklmnopqrstuvwxyz",a.passwordData.complexity.uppercase&&(d+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"));for(;m++<=a.passwordData.complexity.numlength;)e+=d.charAt(Math.floor(Math.random()*(d.length-1)+0));$("#viewPass").attr("title",e);var c=zxcvbn(e);a.passwordData.passLength=e.length;b?(m=b.parent(),d=$("#"+b.attr("id")+"R"),a.outputResult(c,b),b=new MaterialTextfield,m.find("input:password").val(e),m.addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID), -0"); +a.passwordData.complexity.numbers&&(d+="1234567890");a.passwordData.complexity.chars&&(d+="abcdefghijklmnopqrstuvwxyz",a.passwordData.complexity.uppercase&&(d+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"));for(;f++<=a.passwordData.complexity.numlength;)h+=d.charAt(Math.floor(Math.random()*(d.length-1)+0));$("#viewPass").attr("title",h);var c=zxcvbn(h);a.passwordData.passLength=h.length;b?(f=b.parent(),d=$("#"+b.attr("id")+"R"),a.outputResult(c,b),b=new MaterialTextfield,f.find("input:password").val(h),f.addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID), +0
    ";mdlDialog().show({title:a.config().LANG[29],text:b,negative:{title:a.config().LANG[44]},positive:{title:a.config().LANG[43],onClick:function(b){b.preventDefault();a.passwordData.complexity.chars=$("#checkbox-chars").is(":checked");a.passwordData.complexity.numbers=$("#checkbox-numbers").is(":checked");a.passwordData.complexity.uppercase=$("#checkbox-uppercase").is(":checked");a.passwordData.complexity.symbols=$("#checkbox-symbols").is(":checked");a.passwordData.complexity.numlength= -parseInt($("#passlength").val())}},cancelable:!0,contentStyle:{"max-width":"300px"},onLoaded:function(){$("#checkbox-chars").prop("checked",a.passwordData.complexity.chars);$("#checkbox-numbers").prop("checked",a.passwordData.complexity.numbers);$("#checkbox-uppercase").prop("checked",a.passwordData.complexity.uppercase);$("#checkbox-symbols").prop("checked",a.passwordData.complexity.symbols);$("#passlength").val(a.passwordData.complexity.numlength)}})},l=function(b){b.find(".passwordfield__input").each(function(){var b= -$(this);if("true"!==b.attr("data-pass-upgraded")){var d=b.parent(),c=b.attr("id"),k='',k=k+('
      ')+('
    • settings'+a.config().LANG[28]+"
    • "),k=k+('
    • vpn_key'+ -a.config().LANG[29]+"
    • "),k=k+('
    • refresh'+a.config().LANG[30]+"
    • ");d.after('
      ');d.next(".password-actions").prepend('').prepend('remove_red_eye').prepend(k);b.on("keyup",function(){a.checkPassLevel(b)});d=b.parent().next();d.find(".passGen").on("click", -function(){g(b);b.focus()});d.find(".passComplexity").on("click",function(){h()});d.find(".showpass").on("mouseover",function(){$(this).attr("title",b.val())});d.find(".reset").on("click",function(){b.val("");var a=$("#"+c+"R");0remove_red_eye');if(1===b.data("clipboard")){var c= -$('content_paste');b.parent().after(c).after(d)}else b.parent().after(d);d.on("mouseover",function(){d.attr("title",b.val())})})},n=function(b){f.info("setupDatePicker");var c={format:"YYYY-MM-DD",lang:a.config().LOCALE.substr(0,2),time:!1,cancelText:a.config().LANG[44],okText:a.config().LANG[43],clearText:a.config().LANG[30],nowText:a.config().LANG[56],minDate:new Date,triggerEvent:"dateIconClick"}; +"
      ";mdlDialog().show({title:a.config().LANG[29],text:b,negative:{title:a.config().LANG[44]},positive:{title:a.config().LANG[43],onClick:function(f){f.preventDefault();a.passwordData.complexity.chars=$("#checkbox-chars").is(":checked");a.passwordData.complexity.numbers=$("#checkbox-numbers").is(":checked");a.passwordData.complexity.uppercase=$("#checkbox-uppercase").is(":checked");a.passwordData.complexity.symbols=$("#checkbox-symbols").is(":checked");a.passwordData.complexity.numlength= +parseInt($("#passlength").val())}},cancelable:!0,contentStyle:{"max-width":"300px"},onLoaded:function(){$("#checkbox-chars").prop("checked",a.passwordData.complexity.chars);$("#checkbox-numbers").prop("checked",a.passwordData.complexity.numbers);$("#checkbox-uppercase").prop("checked",a.passwordData.complexity.uppercase);$("#checkbox-symbols").prop("checked",a.passwordData.complexity.symbols);$("#passlength").val(a.passwordData.complexity.numlength)}})},l=function(b){b.find(".passwordfield__input").each(function(){var f= +$(this);if("true"!==f.attr("data-pass-upgraded")){var d=f.parent(),b=f.attr("id"),c='',c=c+('
        ')+('
      • settings'+a.config().LANG[28]+"
      • "),c=c+('
      • vpn_key'+ +a.config().LANG[29]+"
      • "),c=c+('
      • refresh'+a.config().LANG[30]+"
      • ");d.after('
        ');d.next(".password-actions").prepend('').prepend('remove_red_eye').prepend(c);f.on("keyup",function(){a.checkPassLevel(f)});d=f.parent().next();d.find(".passGen").on("click", +function(){g(f);f.focus()});d.find(".passComplexity").on("click",function(){k()});d.find(".showpass").on("mouseover",function(){$(this).attr("title",f.val())});d.find(".reset").on("click",function(){f.val("");var a=$("#"+b+"R");0remove_red_eye');if(1===b.data("clipboard")){var c= +$('content_paste');b.parent().after(c).after(d)}else b.parent().after(d);d.on("mouseover",function(){d.attr("title",b.val())})})},m=function(b){e.info("setupDatePicker");var c={format:"YYYY-MM-DD",lang:a.config().LOCALE.substr(0,2),time:!1,cancelText:a.config().LANG[44],okText:a.config().LANG[43],clearText:a.config().LANG[30],nowText:a.config().LANG[56],minDate:new Date,triggerEvent:"dateIconClick"}; b.find(".password-datefield__input").each(function(){var b=$(this);b.bootstrapMaterialDatePicker(c);b.parent().append("");b.parent().next("i").on("click",function(){b.trigger("dateIconClick")});b.on("change",function(){var c;c=moment.tz(b.val(),a.config().TIMEZONE).format("X");b.parent().find("input[name='passworddatechange_unix']").val(c)})})};return{passwordDetect:l,password:g,viewsTriggers:{main:function(){var a= document.querySelector(".mdl-layout");$(".mdl-layout__drawer").find("a").click(function(){a.MaterialLayout.toggleDrawer()})},search:function(){var b=$("#frmSearch"),c=$("#res-content");b.find("button.btn-clear").on("click",function(a){$(".icon-searchfav").find("i").removeClass("mdl-color-text--amber-A200")});b.find(".icon-searchfav").on("click",function(){var c=$(this).find("i"),d=b.find("input[name='searchfav']");0==d.val()?(c.addClass("mdl-color-text--amber-A200"),c.attr("title",a.config().LANG[53]), -d.val(1)):(c.removeClass("mdl-color-text--amber-A200"),c.attr("title",a.config().LANG[52]),d.val(0));b.submit()});var d=b.find("#tags")[0],e=b.find(".search-filters-tags"),k=b.find("i.show-filter");c.on("click","#data-search-header .sort-down,#data-search-header .sort-up",function(){var b=$(this);b.parent().find("a").addClass("filterOn");a.appActions().account.sort(b)}).on("click","#search-rows i.icon-favorite",function(){var b=$(this);a.appActions().account.savefavorite(b,function(){"on"===b.data("status")? -(b.addClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[50]),b.html("star")):(b.removeClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[49]),b.html("star_border"))})}).on("click","#search-rows span.tag",function(){e.is(":hidden")&&k.trigger("click");d.selectize.addItem($(this).data("tag-id"))});k.on("click",function(){var a=$(this);e.is(":hidden")?(e.slideDown("slow"),a.html(a.data("icon-up"))):(e.slideUp("slow"),a.html(a.data("icon-down")))});0
      '),c=$('
    • '),e=$('');a.forEach(function(a){var d=e.clone();d.append('person');d.append(a);a=c.clone().append(d);b.append(a)});return b},tabs:{add:function(a, -c,d,e){a=$(a);var b="";1===e&&(a.parent().find("#tabs-"+c).addClass("is-active"),b="is-active");a.append(''+d+"")}}}}}; +d.val(1)):(c.removeClass("mdl-color-text--amber-A200"),c.attr("title",a.config().LANG[52]),d.val(0));b.submit()});var d=b.find("#tags")[0],h=b.find(".search-filters-tags"),e=b.find("i.show-filter");c.on("click","#data-search-header .sort-down,#data-search-header .sort-up",function(){var b=$(this);b.parent().find("a").addClass("filterOn");a.appActions().account.sort(b)}).on("click","#search-rows i.icon-favorite",function(){var b=$(this);a.appActions().account.savefavorite(b,function(){"on"===b.data("status")? +(b.addClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[50]),b.html("star")):(b.removeClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[49]),b.html("star_border"))})}).on("click","#search-rows span.tag",function(){h.is(":hidden")&&e.trigger("click");d.selectize.addItem($(this).data("tag-id"))});e.on("click",function(){var a=$(this);h.is(":hidden")?(h.slideDown("slow"),a.html(a.data("icon-up"))):(h.slideUp("slow"),a.html(a.data("icon-down")))});0
    '),f=$('
  • '),e=$('');c=void 0===c?'person':''+c+"";a.forEach(function(a){var d=e.clone();d.append(c); +d.append(a);a=f.clone().append(d);b.append(a)});return b},tabs:{add:function(a,c,d,e){a=$(a);var b="";1===e&&(a.parent().find("#tabs-"+c).addClass("is-active"),b="is-active");a.append(''+d+"")}}}}}; diff --git a/js/app-triggers.js b/js/app-triggers.js index eb27428a..7a8f283d 100644 --- a/js/app-triggers.js +++ b/js/app-triggers.js @@ -80,7 +80,15 @@ sysPass.Triggers = function (Common) { */ var btnAction = function ($obj) { var onclick = $obj.data("onclick").split("/"); - var actions = Common.appActions(); + var actions; + + var plugin = $obj.data("plugin"); + + if (typeof plugin !== "undefined") { + actions = sysPass.Plugin[plugin](Common); + } else { + actions = Common.appActions(); + } if (onclick.length === 2) { actions[onclick[0]][onclick[1]]($obj); diff --git a/js/app-triggers.min.js b/js/app-triggers.min.js index 9fbae1e9..8cfe40e6 100644 --- a/js/app-triggers.min.js +++ b/js/app-triggers.min.js @@ -1,7 +1,7 @@ var $jscomp={scope:{},findInternal:function(b,d,e){b instanceof String&&(b=String(b));for(var a=b.length,c=0;c