add 2FA mechanism, fixes #547

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-11-30 13:45:17 +01:00
parent 29c754e700
commit 69495b94af
32 changed files with 1563 additions and 218 deletions

26
templates/Sparkle/2fa/entercode.tpl vendored Normal file
View File

@@ -0,0 +1,26 @@
$header
<article class="login bradius">
<header class="dark">
<img src="{$header_logo}" alt="Froxlor Server Management Panel" />
</header>
<section class="loginsec">
<form method="post" action="{$filename}" enctype="application/x-www-form-urlencoded">
<fieldset>
<legend>Froxlor&nbsp;-&nbsp;{$lng['login']['2fa']}</legend>
<p>
<label for="2fa_code">{$lng['login']['2facode']}:</label>&nbsp;
<input type="text" name="2fa_code" id="2fa_code" value="" required/>
</p>
<p class="submit">
<input type="hidden" name="action" value="2fa_verify" />
<input type="hidden" name="send" value="send" />
<input type="submit" value="{$lng['2fa']['2fa_verify']}" />
</p>
</fieldset>
</form>
<aside>
<a href="index.php">{$lng['login']['backtologin']}</a>
</aside>
</section>
</article>
$footer

40
templates/Sparkle/2fa/overview.tpl vendored Normal file
View File

@@ -0,0 +1,40 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/icons/lock_big.png"
alt="" />&nbsp; {$lng['login']['2fa']}
</h2>
</header>
<section>
<if $userinfo['type_2fa'] == '0'>
<form method="post"
action="{$linker->getLink(array('section' => 'index', 'page' => $page, 'action' => 'add'))}">
<p>{$lng['2fa']['2fa_overview_desc']}</p><br>
<select id="type_2fa" name="type_2fa" class="small">{$type_select}
</select>&nbsp;<input type="submit" class="submit" value="{$lng['2fa']['2fa_add']}" name="add" />
</form>
</if>
<if $userinfo['type_2fa'] == '1'>
<form method="post"
action="{$linker->getLink(array('section' => 'index', 'page' => $page, 'action' => 'delete'))}">
<p>{$lng['2fa']['2fa_email_desc']}</p><br>
<input type="submit" class="cancel" value="{$lng['2fa']['2fa_delete']}" name="delete" />
</form>
</if>
<if $userinfo['type_2fa'] == '2'>
<form method="post"
action="{$linker->getLink(array('section' => 'index', 'page' => $page, 'action' => 'delete'))}">
<p>{$lng['2fa']['2fa_ga_desc']}</p><br>
<img src="{$ga_qrcode}" alt="QRCode" /><br><br>
<input type="submit" class="cancel" value="{$lng['2fa']['2fa_delete']}" name="delete" />
</form>
</if>
</section>
</article>
$footer

View File

@@ -61,6 +61,9 @@
<ul>
<li><a href="{$linker->getLink(array('section' => 'index', 'page' => 'change_password'))}">{$lng['login']['password']}</a></li>
<li><a href="{$linker->getLink(array('section' => 'index', 'page' => 'change_language'))}">{$lng['login']['language']}</a></li>
<if Settings::Get('2fa.enabled') == 1>
<li><a href="{$linker->getLink(array('section' => 'index', 'page' => '2fa'))}">{$lng['2fa']['2fa']}</a></li>
</if>
<if Settings::Get('panel.allow_theme_change_admin') == '1' && $userinfo['adminsession'] == 1>
<li><a href="{$linker->getLink(array('section' => 'index', 'page' => 'change_theme'))}">{$lng['panel']['theme']}</a></li>
</if>