mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-23 09:31:04 +00:00
Merge pull request #6723 from wallabag/remove-2fa-parameter
Remove `twofactor_auth` parameter
This commit is contained in:
commit
11617ca7e1
8 changed files with 36 additions and 78 deletions
|
@ -201,15 +201,15 @@ scheb_two_factor:
|
||||||
lifetime: 2592000
|
lifetime: 2592000
|
||||||
|
|
||||||
backup_codes:
|
backup_codes:
|
||||||
enabled: "%twofactor_auth%"
|
enabled: true
|
||||||
|
|
||||||
google:
|
google:
|
||||||
enabled: "%twofactor_auth%"
|
enabled: true
|
||||||
issuer: "%server_name%"
|
issuer: "%server_name%"
|
||||||
template: "@WallabagUser/Authentication/form.html.twig"
|
template: "@WallabagUser/Authentication/form.html.twig"
|
||||||
|
|
||||||
email:
|
email:
|
||||||
enabled: "%twofactor_auth%"
|
enabled: true
|
||||||
sender_email: "%twofactor_sender%"
|
sender_email: "%twofactor_sender%"
|
||||||
digits: 6
|
digits: 6
|
||||||
template: "@WallabagUser/Authentication/form.html.twig"
|
template: "@WallabagUser/Authentication/form.html.twig"
|
||||||
|
|
|
@ -34,7 +34,6 @@ parameters:
|
||||||
secret: CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM
|
secret: CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM
|
||||||
|
|
||||||
# two factor stuff
|
# two factor stuff
|
||||||
twofactor_auth: true
|
|
||||||
twofactor_sender: no-reply@wallabag.org
|
twofactor_sender: no-reply@wallabag.org
|
||||||
|
|
||||||
# fosuser stuff
|
# fosuser stuff
|
||||||
|
|
|
@ -22,7 +22,6 @@ parameters:
|
||||||
secret: ${SECRET:-~}
|
secret: ${SECRET:-~}
|
||||||
|
|
||||||
# two factor stuff
|
# two factor stuff
|
||||||
twofactor_auth: ${TWOFACTOR_AUTH:-true}
|
|
||||||
twofactor_sender: ${TWOFACTOR_SENDER:-no-reply@wallabag.org}
|
twofactor_sender: ${TWOFACTOR_SENDER:-no-reply@wallabag.org}
|
||||||
|
|
||||||
# fosuser stuff
|
# fosuser stuff
|
||||||
|
|
|
@ -246,7 +246,6 @@ class ConfigController extends AbstractController
|
||||||
'username' => $user->getUsername(),
|
'username' => $user->getUsername(),
|
||||||
'token' => $config->getFeedToken(),
|
'token' => $config->getFeedToken(),
|
||||||
],
|
],
|
||||||
'twofactor_auth' => $this->getParameter('twofactor_auth'),
|
|
||||||
'wallabag_url' => $this->getParameter('domain_name'),
|
'wallabag_url' => $this->getParameter('domain_name'),
|
||||||
'enabled_users' => $userRepository->getSumEnabledUsers(),
|
'enabled_users' => $userRepository->getSumEnabledUsers(),
|
||||||
]);
|
]);
|
||||||
|
@ -259,10 +258,6 @@ class ConfigController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function disableOtpEmailAction()
|
public function disableOtpEmailAction()
|
||||||
{
|
{
|
||||||
if (!$this->getParameter('twofactor_auth')) {
|
|
||||||
return $this->createNotFoundException('two_factor not enabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$user->setEmailTwoFactor(false);
|
$user->setEmailTwoFactor(false);
|
||||||
|
|
||||||
|
@ -283,10 +278,6 @@ class ConfigController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function otpEmailAction()
|
public function otpEmailAction()
|
||||||
{
|
{
|
||||||
if (!$this->getParameter('twofactor_auth')) {
|
|
||||||
return $this->createNotFoundException('two_factor not enabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
$user->setGoogleAuthenticatorSecret(null);
|
$user->setGoogleAuthenticatorSecret(null);
|
||||||
|
@ -310,10 +301,6 @@ class ConfigController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function disableOtpAppAction()
|
public function disableOtpAppAction()
|
||||||
{
|
{
|
||||||
if (!$this->getParameter('twofactor_auth')) {
|
|
||||||
return $this->createNotFoundException('two_factor not enabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
$user->setGoogleAuthenticatorSecret('');
|
$user->setGoogleAuthenticatorSecret('');
|
||||||
|
@ -336,10 +323,6 @@ class ConfigController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function otpAppAction(GoogleAuthenticatorInterface $googleAuthenticator)
|
public function otpAppAction(GoogleAuthenticatorInterface $googleAuthenticator)
|
||||||
{
|
{
|
||||||
if (!$this->getParameter('twofactor_auth')) {
|
|
||||||
return $this->createNotFoundException('two_factor not enabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$secret = $googleAuthenticator->generateSecret();
|
$secret = $googleAuthenticator->generateSecret();
|
||||||
|
|
||||||
|
@ -377,10 +360,6 @@ class ConfigController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function otpAppCancelAction()
|
public function otpAppCancelAction()
|
||||||
{
|
{
|
||||||
if (!$this->getParameter('twofactor_auth')) {
|
|
||||||
return $this->createNotFoundException('two_factor not enabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$user->setGoogleAuthenticatorSecret(null);
|
$user->setGoogleAuthenticatorSecret(null);
|
||||||
$user->setBackupCodes(null);
|
$user->setBackupCodes(null);
|
||||||
|
|
|
@ -209,7 +209,6 @@
|
||||||
|
|
||||||
{{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
|
{{ form_widget(form.user.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
|
||||||
|
|
||||||
{% if twofactor_auth %}
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -240,7 +239,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{{ form_widget(form.user._token) }}
|
{{ form_widget(form.user._token) }}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -85,20 +85,18 @@ class ManageController extends AbstractController
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
// `googleTwoFactor` isn't a field within the User entity, we need to define it's value in a different way
|
// `googleTwoFactor` isn't a field within the User entity, we need to define it's value in a different way
|
||||||
if ($this->getParameter('twofactor_auth') && true === $user->isGoogleAuthenticatorEnabled() && false === $form->isSubmitted()) {
|
if (true === $user->isGoogleAuthenticatorEnabled() && false === $form->isSubmitted()) {
|
||||||
$form->get('googleTwoFactor')->setData(true);
|
$form->get('googleTwoFactor')->setData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
// handle creation / reset of the OTP secret if checkbox changed from the previous state
|
// handle creation / reset of the OTP secret if checkbox changed from the previous state
|
||||||
if ($this->getParameter('twofactor_auth')) {
|
|
||||||
if (true === $form->get('googleTwoFactor')->getData() && false === $user->isGoogleAuthenticatorEnabled()) {
|
if (true === $form->get('googleTwoFactor')->getData() && false === $user->isGoogleAuthenticatorEnabled()) {
|
||||||
$user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret());
|
$user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret());
|
||||||
$user->setEmailTwoFactor(false);
|
$user->setEmailTwoFactor(false);
|
||||||
} elseif (false === $form->get('googleTwoFactor')->getData() && true === $user->isGoogleAuthenticatorEnabled()) {
|
} elseif (false === $form->get('googleTwoFactor')->getData() && true === $user->isGoogleAuthenticatorEnabled()) {
|
||||||
$user->setGoogleAuthenticatorSecret(null);
|
$user->setGoogleAuthenticatorSecret(null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$userManager->updateUser($user);
|
$userManager->updateUser($user);
|
||||||
|
|
||||||
|
@ -114,7 +112,6 @@ class ManageController extends AbstractController
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'edit_form' => $form->createView(),
|
'edit_form' => $form->createView(),
|
||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
'twofactor_auth' => $this->getParameter('twofactor_auth'),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if twofactor_auth %}
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
{{ form_widget(edit_form.emailTwoFactor) }}
|
{{ form_widget(edit_form.emailTwoFactor) }}
|
||||||
|
@ -60,7 +59,6 @@
|
||||||
{{ form_errors(edit_form.googleTwoFactor) }}
|
{{ form_errors(edit_form.googleTwoFactor) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,6 @@ class SecurityControllerTest extends WallabagCoreTestCase
|
||||||
{
|
{
|
||||||
$client = $this->getTestClient();
|
$client = $this->getTestClient();
|
||||||
|
|
||||||
if (!$client->getContainer()->getParameter('twofactor_auth')) {
|
|
||||||
$this->markTestSkipped('twofactor_auth is not enabled.');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$client->followRedirects();
|
$client->followRedirects();
|
||||||
|
|
||||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||||
|
@ -65,12 +59,6 @@ class SecurityControllerTest extends WallabagCoreTestCase
|
||||||
{
|
{
|
||||||
$client = $this->getTestClient();
|
$client = $this->getTestClient();
|
||||||
|
|
||||||
if (!$client->getContainer()->getParameter('twofactor_auth')) {
|
|
||||||
$this->markTestSkipped('twofactor_auth is not enabled.');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$client->followRedirects();
|
$client->followRedirects();
|
||||||
|
|
||||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||||
|
|
Loading…
Reference in a new issue