Simple.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Second authentication factor handling
  4. */
  5. declare(strict_types=1);
  6. namespace PhpMyAdmin\Plugins\TwoFactor;
  7. use PhpMyAdmin\Plugins\TwoFactorPlugin;
  8. /**
  9. * Simple two-factor authentication auth asking just for confirmation.
  10. *
  11. * This has no practical use, but can be used for testing.
  12. */
  13. class Simple extends TwoFactorPlugin
  14. {
  15. /** @var string */
  16. public static $id = 'simple';
  17. /**
  18. * Checks authentication, returns true on success
  19. *
  20. * @return bool
  21. */
  22. public function check()
  23. {
  24. return isset($_POST['2fa_confirm']);
  25. }
  26. /**
  27. * Renders user interface to enter two-factor authentication
  28. *
  29. * @return string HTML code
  30. */
  31. public function render()
  32. {
  33. return $this->template->render('login/twofactor/simple');
  34. }
  35. /**
  36. * Get user visible name
  37. *
  38. * @return string
  39. */
  40. public static function getName()
  41. {
  42. return __('Simple two-factor authentication');
  43. }
  44. /**
  45. * Get user visible description
  46. *
  47. * @return string
  48. */
  49. public static function getDescription()
  50. {
  51. return __('For testing purposes only!');
  52. }
  53. }