Added two factor auth setting to Preferences page.

This commit is contained in:
zjean 2016-02-08 22:28:24 +01:00
parent fbe3be169d
commit e04388a230
4 changed files with 42 additions and 11 deletions

View File

@ -32,22 +32,23 @@ class PreferencesController extends Controller
*/
public function index(ARI $repository)
{
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
$viewRangePref = Preferences::get('viewRange', '1M');
$viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000);
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$budgetMaximum = $budgetMax->data;
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
$viewRangePref = Preferences::get('viewRange', '1M');
$viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000);
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$budgetMaximum = $budgetMax->data;
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$twoFactorAuthEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data;
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', 'false') == 'true';
return view(
'preferences.index',
compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'customFiscalYear', 'fiscalYearStart', 'showIncomplete')
compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'customFiscalYear', 'fiscalYearStart', 'twoFactorAuthEnabled', 'showIncomplete')
);
}
@ -82,6 +83,10 @@ class PreferencesController extends Controller
$fiscalYearStart = date('m-d', strtotime(Input::get('fiscalYearStart')));
Preferences::set('fiscalYearStart', $fiscalYearStart);
// two factor auth
$twoFactorAuthEnabled = (int)Input::get('twoFactorAuthEnabled');
Preferences::set('twoFactorAuthEnabled', $twoFactorAuthEnabled);
// language:
$lang = Input::get('language');
if (in_array($lang, array_keys(Config::get('firefly.languages')))) {

View File

@ -211,6 +211,9 @@ return [
'pref_custom_fiscal_year_label' => 'Enabled',
'pref_custom_fiscal_year_help' => 'In countries that use a financial year other than January 1 to December 31, you can switch this on and specify start / end days of the fiscal year',
'pref_fiscal_year_start_label' => 'Fiscal year start date',
'pref_two_factor_auth' => '2-step verification',
'pref_two_factor_auth_help' => '2-step verification provides improved security for your Firefly III account. If 2-step verification is enabled, you will need to enter your password in addition to a one-time verification code when logging into Firefly III. Verification codes are obtained from authenticator apps installed on your mobile device. Examples of aps are Authy or Google Authenticator. Therefore, if someone wants to access your account, he will not only need your username and password, but also your mobile device.',
'pref_enable_two_factor_auth' => 'Enable 2-step verification',
'pref_save_settings' => 'Save settings',
// profile:

View File

@ -209,6 +209,9 @@ return [
'pref_custom_fiscal_year_label' => 'Ingeschakeld',
'pref_custom_fiscal_year_help' => 'Voor in landen die een boekjaar gebruiken anders dan 1 januari tot 31 december',
'pref_fiscal_year_start_label' => 'Start van boekjaar',
'pref_two_factor_auth' => '2-stapsverificatie',
'pref_two_factor_auth_help' => 'De 2-stapsverificatie biedt een verbeterde beveiliging van uw Firefly III-account. Schakelt u de 2-stapsverificatie in, dan hebt u uw wachtwoord en een eenmalige verificatiecode nodig om u bij Firefly III aan te melden. De verificatiecodes krijgt u van een app geïnstalleerd op uw mobiele telefoon. Voorbeelden van deze app zijn Authy en Google Authenticator. Mocht iemand toegang tot uw account willen, dan heeft hij naast uw gebruikersnaam en wachtwoord ook uw mobiele telefoon nodig.',
'pref_enable_two_factor_auth' => '2-stapsverificatie inschakelen',
'pref_save_settings' => 'Instellingen opslaan',
// profile:

View File

@ -137,6 +137,26 @@
</div>
</div>
</div>
<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_two_factor_auth'|_ }}</h3>
</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>
</div>
</div>
</div>
</div>
</div>
<div class="row">