summaryrefslogtreecommitdiff
path: root/app/Auth
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-05 20:31:15 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-05 20:31:15 -0500
commite62779e26781c849bdc24f40e94330bec97f8069 (patch)
treefe72ffad1e8da07684d1400753ad6a2c794c21f5 /app/Auth
parent811254ba93592de2470aee54cd21096d082b45ce (diff)
Improve 2FA
Diffstat (limited to 'app/Auth')
-rw-r--r--app/Auth/TotpAuth.php28
1 files changed, 23 insertions, 5 deletions
diff --git a/app/Auth/TotpAuth.php b/app/Auth/TotpAuth.php
index f41fabd8..e1cc712c 100644
--- a/app/Auth/TotpAuth.php
+++ b/app/Auth/TotpAuth.php
@@ -40,7 +40,7 @@ class TotpAuth extends Base implements PostAuthenticationProviderInterface
*/
public function getName()
{
- return 'Time-based One-time Password Algorithm';
+ return t('Time-based One-time Password Algorithm');
}
/**
@@ -56,6 +56,16 @@ class TotpAuth extends Base implements PostAuthenticationProviderInterface
}
/**
+ * Called before to prompt the user
+ *
+ * @access public
+ */
+ public function beforeCode()
+ {
+
+ }
+
+ /**
* Set validation code
*
* @access public
@@ -67,6 +77,18 @@ class TotpAuth extends Base implements PostAuthenticationProviderInterface
}
/**
+ * Generate secret
+ *
+ * @access public
+ * @return string
+ */
+ public function generateSecret()
+ {
+ $this->secret = GoogleAuthenticator::generateRandom();
+ return $this->secret;
+ }
+
+ /**
* Set secret token
*
* @access public
@@ -85,10 +107,6 @@ class TotpAuth extends Base implements PostAuthenticationProviderInterface
*/
public function getSecret()
{
- if (empty($this->secret)) {
- $this->secret = GoogleAuthenticator::generateRandom();
- }
-
return $this->secret;
}