Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/www/authgui.inc
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,12 @@ function session_auth()

/* Validate incoming login request */
if (isset($_POST['login']) && !empty($_POST['usernamefld']) && !empty($_POST['passwordfld'])) {
$tmp_otp = '';
if (!empty($_POST['otpfld']) && is_numeric($_POST['otpfld'])) {
$tmp_otp = $_POST['otpfld'];
}
$authFactory = new \OPNsense\Auth\AuthenticationFactory();
$is_authenticated = $authFactory->authenticate("WebGui", $_POST['usernamefld'], $_POST['passwordfld']);
$is_authenticated = $authFactory->authenticate("WebGui", $_POST['usernamefld'], $_POST['passwordfld'].$tmp_otp);

if ($is_authenticated) {
$authenticator = $authFactory->lastUsedAuth;
Expand All @@ -178,7 +182,7 @@ function session_auth()
$_SESSION['Username'] = $authenticator->getUserName($_POST['usernamefld']);
$_SESSION['last_access'] = time();
$_SESSION['protocol'] = $config['system']['webgui']['protocol'];
if ($authenticator != null && $authenticator->shouldChangePassword($_SESSION['Username'], $_POST['passwordfld'])) {
if ($authenticator != null && $authenticator->shouldChangePassword($_SESSION['Username'], $_POST['passwordfld'].$tmp_otp)) {
$_SESSION['user_shouldChangePassword'] = true;
}
if (!isset($config['system']['webgui']['quietlogin'])) {
Expand Down Expand Up @@ -410,7 +414,10 @@ function display_login_form($Login_Error)
<label for="passwordfld"><?=gettext("Password:"); ?></label>
<input id="passwordfld" type="password" name="passwordfld" class="form-control pwd" tabindex="2" />
</div>

<div class="form-group">
<label for="otpfld"><?=gettext("Optional OTP:"); ?></label>
<input id="otpfld" type="tel" name="otpfld" class="form-control pwd" tabindex="3" />
</div>
<button type="submit" name="login" value="1" class="btn btn-primary pull-right"><?=gettext("Login"); ?></button>

</form>
Expand Down