Internationalise several forms for #1090

This commit is contained in:
James Cole 2018-01-02 17:25:59 +01:00
parent 4ec123a19a
commit fa676f60fb
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
8 changed files with 93 additions and 39 deletions

View File

@ -22,7 +22,9 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Auth; namespace FireflyIII\Http\Controllers\Auth;
use FireflyConfig;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\User;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
/** /**
@ -43,6 +45,24 @@ class ForgotPasswordController extends Controller
use SendsPasswordResetEmails; use SendsPasswordResetEmails;
/**
* Display the form to request a password reset link.
*
* @return \Illuminate\Http\Response
*/
public function showLinkRequestForm()
{
// is allowed to?
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count();
$allowRegistration = true;
if (true === $singleUserMode && $userCount > 0) {
$allowRegistration = false;
}
return view('auth.passwords.email')->with(compact('allowRegistration'));
}
/** /**
* Create a new controller instance. * Create a new controller instance.
*/ */

View File

@ -22,8 +22,11 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Auth; namespace FireflyIII\Http\Controllers\Auth;
use FireflyConfig;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\User;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
@ -52,4 +55,28 @@ class ResetPasswordController extends Controller
parent::__construct(); parent::__construct();
$this->middleware('guest'); $this->middleware('guest');
} }
/**
* Display the password reset view for the given token.
*
* If no token is present, display the link request form.
*
* @param Request $request
* @param string|null $token
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showResetForm(Request $request, $token = null)
{
// is allowed to?
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count();
$allowRegistration = true;
if (true === $singleUserMode && $userCount > 0) {
$allowRegistration = false;
}
return view('auth.passwords.reset')->with(
['token' => $token, 'email' => $request->email, 'allowRegistration' => $allowRegistration]
);
}
} }

View File

@ -141,6 +141,16 @@ return [
'invalid_server_configuration' => 'Invalid server configuration', 'invalid_server_configuration' => 'Invalid server configuration',
'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are <a href="https://github.com/firefly-iii/help/wiki/Missing-locale-packages">instructions how to do this</a>.', 'invalid_locale_settings' => 'Firefly III is unable to format monetary amounts because your server is missing the required packages. There are <a href="https://github.com/firefly-iii/help/wiki/Missing-locale-packages">instructions how to do this</a>.',
'quickswitch' => 'Quickswitch', 'quickswitch' => 'Quickswitch',
'sign_in_to_start' => 'Sign in to start your session',
'sign_in' => 'Sign in',
'register_new_account' => 'Register a new account',
'forgot_my_password' => 'I forgot my password',
'problems_with_input' => 'There were some problems with your input.',
'reset_password' => 'Reset your password',
'button_reset_password' => 'Reset password',
'reset_button' => 'Reset',
'want_to_login' => 'I want to login',
'button_register' => 'Register',
// check for updates: // check for updates:
'update_check_title' => 'Check for updates', 'update_check_title' => 'Check for updates',
@ -613,6 +623,7 @@ return [
'bill_will_automatch' => 'Bill will automatically linked to matching transactions', 'bill_will_automatch' => 'Bill will automatically linked to matching transactions',
'skips_over' => 'skips over', 'skips_over' => 'skips over',
// accounts: // accounts:
'details_for_asset' => 'Details for asset account ":name"', 'details_for_asset' => 'Details for asset account ":name"',
'details_for_expense' => 'Details for expense account ":name"', 'details_for_expense' => 'Details for expense account ":name"',

View File

@ -78,6 +78,7 @@ return [
'new_email_address' => 'New email address', 'new_email_address' => 'New email address',
'verification' => 'Verification', 'verification' => 'Verification',
'api_key' => 'API key', 'api_key' => 'API key',
'remember_me' => 'Remember me',
'source_account_asset' => 'Source account (asset account)', 'source_account_asset' => 'Source account (asset account)',
'destination_account_expense' => 'Destination account (expense account)', 'destination_account_expense' => 'Destination account (expense account)',

View File

@ -29,7 +29,7 @@
<div class="alert alert-danger alert-dismissible" role="alert"> <div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert"><span>&times;</span><span class="sr-only">{{ 'close'|_ }}</span> <button type="button" class="close" data-dismiss="alert"><span>&times;</span><span class="sr-only">{{ 'close'|_ }}</span>
</button> </button>
<strong>Error!</strong> {{ errors.get('email')[0] }} <strong>{{ 'flash_error'|_ }}!</strong> {{ errors.get('email')[0] }}
</div> </div>
</div> </div>
</div> </div>
@ -48,36 +48,36 @@
{% endif %} {% endif %}
<div class="login-box-body"> <div class="login-box-body">
<p class="login-box-msg">Sign in to start your session</p> <p class="login-box-msg">{{ 'sign_in_to_start'|_ }}</p>
<form action="{{ URL.to('/login') }}" method="post"> <form action="{{ URL.to('/login') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/> <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="email" name="email" value="{{ email }}" class="form-control" placeholder="Email"/> <input type="email" name="email" value="{{ email }}" class="form-control" placeholder="{{ trans('form.email') }}"/>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" name="password" class="form-control" placeholder="Password"/> <input type="password" name="password" class="form-control" placeholder="{{ trans('form.password') }}"/>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="remember" {% if remember %}checked="checked"{% endif %} value="1"> Remember Me <input type="checkbox" name="remember" {% if remember %}checked="checked"{% endif %} value="1"> {{ trans('form.remember_me') }}
</label> </label>
</div> </div>
</div> </div>
<!-- /.col --> <!-- /.col -->
<div class="col-xs-4"> <div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button> <button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'sign_in'|_ }}</button>
</div> </div>
<!-- /.col --> <!-- /.col -->
</div> </div>
</form> </form>
{% if allowRegistration %} {% if allowRegistration %}
<a href="{{ URL.to('/register') }}" class="text-center">Register a new account</a><br> <a href="{{ URL.to('/register') }}" class="text-center">{{ 'register_new_account'|_ }}</a><br>
{% endif %} {% endif %}
<a href="{{ URL.to('/password/reset') }}">I forgot my password</a> <a href="{{ URL.to('/password/reset') }}">{{ 'forgot_my_password'|_ }}</a>
</div> </div>
<!-- /.login-box-body --> <!-- /.login-box-body -->
{% endblock %} {% endblock %}

View File

@ -11,7 +11,7 @@
{% if errors|length > 0 %} {% if errors|length > 0 %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br> <strong>{{ 'flash_error'|_ }}</strong> {{ 'problems_with_input'|_ }}<br><br>
<ul> <ul>
{% for error in errors.all %} {% for error in errors.all %}
<li>{{ error }}</li> <li>{{ error }}</li>
@ -28,19 +28,19 @@
{{ session('status') }} {{ session('status') }}
</p> </p>
{% else %} {% else %}
<p class="login-box-msg">Reset your password</p> <p class="login-box-msg">{{ 'reset_password'|_ }}</p>
<form role="form" method="POST" action="{{ URL.to('/password/email') }}"> <form role="form" method="POST" action="{{ URL.to('/password/email') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/> <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="email" class="form-control" name="email" placeholder="Email"/> <input type="email" class="form-control" name="email" placeholder="{{ trans('form.email') }}"/>
</div> </div>
<div class="row"> <div class="row">
<!-- /.col --> <!-- /.col -->
<div class="col-xs-12"> <div class="col-xs-12">
<button type="submit" class="btn btn-primary btn-flat pull-right">Reset</button> <button type="submit" class="btn btn-primary btn-flat pull-right">{{ 'reset_button'|_ }}</button>
</div> </div>
<!-- /.col --> <!-- /.col -->
</div> </div>
@ -48,10 +48,9 @@
</form> </form>
{% endif %} {% endif %}
<a href="{{ URL.to('/login') }}">{{ 'want_to_login'|_ }}</a><br>
<a href="{{ URL.to('/login') }}">I want to login</a><br> {% if allowRegistration %}
{% if Config.get('auth.allow_register') %} <a href="{{ route('register') }}" class="text-center">{{ 'register_new_account'|_ }}</a><br>
<a href="{{ route('register') }}" class="text-center">Register a new account</a><br>
{% endif %} {% endif %}
</div><!-- /.login-box-body --> </div><!-- /.login-box-body -->

View File

@ -4,7 +4,7 @@
{% if errors|length > 0 %} {% if errors|length > 0 %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br> <strong>{{ 'flash_error'|_ }}</strong> {{ 'problems_with_input'|_ }}<br><br>
<ul> <ul>
{% for error in errors.all %} {% for error in errors.all %}
<li>{{ error }}</li> <li>{{ error }}</li>
@ -14,36 +14,36 @@
{% endif %} {% endif %}
<div class="register-box-body"> <div class="register-box-body">
<p class="login-box-msg">Reset your password</p> <p class="login-box-msg">{{ 'reset_password'|_ }}</p>
<form method="POST" action="{{ url('/password/reset') }}"> <form method="POST" action="{{ url('/password/reset') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}"> <input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="token" value="{{ token }}"> <input type="hidden" name="token" value="{{ token }}">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="email" name="email" class="form-control" value="{{ old('email') }}" placeholder="Email"/> <input type="email" name="email" class="form-control" value="{{ old('email') }}" placeholder="{{ trans('form.email') }}"/>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password" name="password"/> <input type="password" class="form-control" placeholder="{{ trans('form.password') }}" name="password"/>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password (again)" name="password_confirmation"/> <input type="password" class="form-control" placeholder="{{ trans('form.password_confirmation') }}" name="password_confirmation"/>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<button type="submit" class="btn btn-primary pull-right btn-flat">Reset Password</button> <button type="submit" class="btn btn-primary pull-right btn-flat">{{ 'button_reset_password'|_ }}</button>
</div> </div>
<!-- /.col --> <!-- /.col -->
</div> </div>
</form> </form>
<a href="{{ URL.to('/login') }}">I want to login</a><br> <a href="{{ URL.to('/login') }}">{{ 'want_to_login'|_ }}</a><br>
{% if Config.get('auth.allow_register') %} {% if allowRegistration %}
<a href="{{ route('register') }}" class="text-center">Register a new account</a><br> <a href="{{ route('register') }}" class="text-center">{{ 'register_new_account'|_ }}</a><br>
{% endif %} {% endif %}
</div><!-- /.form-box --> </div><!-- /.form-box -->

View File

@ -4,7 +4,7 @@
{% if errors|length > 0 %} {% if errors|length > 0 %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br> <strong>{{ 'flash_error'|_ }}</strong> {{ 'problems_with_input'|_ }}<br><br>
<ul> <ul>
{% for error in errors.all %} {% for error in errors.all %}
<li>{{ error }}</li> <li>{{ error }}</li>
@ -16,42 +16,38 @@
<div class="register-box-body"> <div class="register-box-body">
<p class="login-box-msg">Register a new account</p> <p class="login-box-msg">{{ 'register_new_account'|_ }}</p>
{% if isDemoSite %}
<p class="text-info login-box-msg">Please note that an account on this site will only
work for one (1) month.</p>
{% endif %}
<form id="register" method="POST" action="{{ URL.to('/register') }}"> <form id="register" method="POST" action="{{ URL.to('/register') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}"> <input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="email" name="email" value="{{ email }}" class="form-control" placeholder="Email"/> <input type="email" name="email" value="{{ email }}" class="form-control" placeholder="{{ trans('form.email') }}"/>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password" name="password"/> <input type="password" class="form-control" placeholder="{{ trans('form.password') }}" name="password"/>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Retype password" name="password_confirmation"/> <input type="password" class="form-control" placeholder="{{ trans('form.password_confirmation') }}" name="password_confirmation"/>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="verify_password" value="1"> Verify password <input type="checkbox" name="verify_password" value="1"> {{ trans('form.verify_password') }}<br />
(<a data-toggle="modal" data-target="#passwordModal" href="#passwordModal">what's this?</a>) <a data-toggle="modal" data-target="#passwordModal" href="#passwordModal">{{ 'what_is_pw_security'|_ }}</a>
</label> </label>
</div> </div>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<button class="btn btn-primary pull-right btn-flat">Register</button> <button class="btn btn-primary pull-right btn-flat">{{ 'button_register'|_ }}</button>
</div> </div>
<!-- /.col --> <!-- /.col -->
</div> </div>
</form> </form>
<a href="{{ URL.to('/login') }}">I want to login</a><br> <a href="{{ URL.to('/login') }}">{{ 'want_to_login'|_ }}</a><br>
<a href="{{ URL.to('/password/reset') }}">I forgot my password</a> <a href="{{ URL.to('/password/reset') }}">{{ 'forgot_my_password'|_ }}</a>
</div><!-- /.form-box --> </div><!-- /.form-box -->
{% include 'partials.password-modal' %} {% include 'partials.password-modal' %}