Simple.php 1.3 KB

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