Added 2fa code validation

This commit is contained in:
zjean
2016-03-03 20:45:27 +01:00
parent c5fb734e42
commit 0c009445d4
8 changed files with 199 additions and 12 deletions

View File

@@ -0,0 +1,52 @@
{% extends "./layout/default.twig" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
{% endblock %}
{% block content %}
{{ Form.open({'class' : 'form-horizontal','id' : 'preferences.code'}) }}
<input type="hidden" name="secret" value="{{ secret }}"/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'pref_code'|_ }}</h3>
</div>
<div class="box-body">
<p class="text-info">
{{ 'pref_code_help'|_ }}
</p>
<div class="form group">
<div class="col-sm-8 col-md-offset-4">
<img src="{{ image }}" />
</div>
</div>
<div class="form group">
<div class="col-sm-8 col-md-offset-4">
<p>{{ secret }}</p>
</div>
</div>
{{ ExpandedForm.text('code', code, {'label' : 'Code'}) }}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-success btn-lg">{{ 'pref_save_settings'|_ }}</button>
</div>
</div>
</div>
</div>
<!-- form close -->
{{ Form.close|raw }}
{% endblock %}

View File

@@ -145,19 +145,34 @@
</div>
<div class="box-body">
<p class="text-info">{{ 'pref_two_factor_auth_help'|_ }}</p>
<div class="form-group">
<div class="col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="twoFactorAuthEnabled" value="1"
{% if twoFactorAuthEnabled == '1' %} checked {% endif %}> {{ 'pref_enable_two_factor_auth'|_ }}
</label>
</div>
<div class="form-group">
<div class="col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="twoFactorAuthEnabled" value="1"
{% if twoFactorAuthEnabled == '1' %} checked {% endif %}> {{ 'pref_enable_two_factor_auth'|_ }}
</label>
</div>
</div>
{% if twoFactorAuthEnabled == '1' and hasTwoFactorAuthSecret == true %}
<div class="col-sm-10">
<div class="checkbox">
<label>
<a href="{{ URL.to('/preferences/code') }}">{{ 'pref_two_factor_auth_reset_secret'|_ }}</a>
</label>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
@@ -171,4 +186,4 @@
<!-- form close -->
{{ Form.close|raw }}
{% endblock %}
{% endblock %}