Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
31d00c97b0
63
libraries/classes/Plugins/TwoFactor/Invalid.php
Normal file
63
libraries/classes/Plugins/TwoFactor/Invalid.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Second authentication factor handling
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
namespace PhpMyAdmin\Plugins\TwoFactor;
|
||||
|
||||
use PhpMyAdmin\Plugins\TwoFactorPlugin;
|
||||
use PhpMyAdmin\Template;
|
||||
|
||||
/**
|
||||
* Invalid two-factor authentication showing that configured choice is not available.
|
||||
*/
|
||||
class Invalid extends TwoFactorPlugin
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public static $id = 'invalid';
|
||||
|
||||
/**
|
||||
* Checks authentication, returns true on success
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders user interface to enter two-factor authentication
|
||||
*
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return Template::get('login/twofactor/invalid')->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user visible name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'Invalid two-factor authentication';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user visible description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return 'Error fallback only!';
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,6 +126,8 @@ class TwoFactor
|
||||
$result = 'PhpMyAdmin\\Plugins\\TwoFactorPlugin';
|
||||
if (in_array($name, $this->_available)) {
|
||||
$result = 'PhpMyAdmin\\Plugins\\TwoFactor\\' . ucfirst($name);
|
||||
} elseif (! empty($name)) {
|
||||
$result = 'PhpMyAdmin\\Plugins\\TwoFactor\\Invalid';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
3
templates/login/twofactor/invalid.twig
Normal file
3
templates/login/twofactor/invalid.twig
Normal file
@ -0,0 +1,3 @@
|
||||
<div class="error">
|
||||
{% trans "The configured two factor authentication is not available, please install missing dependencies." %}
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user