Fix 2FA check #1125

This commit is contained in:
James Cole 2018-01-11 20:56:42 +01:00
parent 554b38ccff
commit 4b789979ac
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 12 additions and 4 deletions

View File

@ -125,7 +125,7 @@ class UserController extends Controller
$list = ['twoFactorAuthEnabled', 'twoFactorAuthSecret'];
$preferences = Preferences::getArrayForUser($user, $list);
$user->isAdmin = $user->hasRole('owner');
$is2faEnabled = true === $preferences['twoFactorAuthEnabled'];
$is2faEnabled = 1 === $preferences['twoFactorAuthEnabled'];
$has2faSecret = null !== $preferences['twoFactorAuthSecret'];
$user->has2FA = ($is2faEnabled && $has2faSecret) ? true : false;
$user->prefs = $preferences;

View File

@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
<form method="POST" action="{{ route('preferences.code.store') }}" accept-charset="UTF-8" class="form-horizontal" id="preferences.code">
<form method="POST" action="{{ route('preferences.code.store') }}" accept-charset="UTF-8" class="form-horizontal" id="preferences_code">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
@ -40,7 +40,15 @@
</div>
</div>
</div>
<!-- form close -->
</form>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
$(function () {
"use strict";
// Focus first visible form element.
$("form#preferences_code input:enabled:visible:first").first().select();
});
</script>
{% endblock %}