Simple.php 1.2 KB

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