Show current pw policy in register page

Also adds a warning for when pw policy is set to off
This commit is contained in:
Miguel Nogueira 2021-01-06 03:48:14 +00:00
parent 42868be96e
commit aa2bfac3e5
Signed by: miguel456
GPG Key ID: 2CF61B825316C6A0
3 changed files with 63 additions and 25 deletions

View File

@ -94,7 +94,7 @@ class RegisterController extends Controller
break; break;
case 'medium': case 'medium':
$password = ['required', 'string', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[#?!@$%^&*-]).{10,}$/']; $password = ['required', 'string', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[#?!@$%^&*-]).{12,}$/'];
break; break;
case 'high': case 'high':

View File

@ -14,6 +14,9 @@
<img src="{{ config('adminlte.logo_img') }}" alt="logo" class="logo">{{ config('adminlte.logo') }} <img src="{{ config('adminlte.logo_img') }}" alt="logo" class="logo">{{ config('adminlte.logo') }}
</div> <!-- main content start --> </div> <!-- main content start -->
<p class="login-card-description">{{__('messages.register_acc')}}</p> <p class="login-card-description">{{__('messages.register_acc')}}</p>
@if(\App\Facades\Options::getOption('pw_security_policy') !== 'off')
<div class="alert alert-warning alert-dismissible"> <div class="alert alert-warning alert-dismissible">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<p><b>{{__('messages.pwsec.line1')}}</b></p> <p><b>{{__('messages.pwsec.line1')}}</b></p>
@ -21,20 +24,31 @@
<p>{{__('messages.pwsec.line3')}} </p> <p>{{__('messages.pwsec.line3')}} </p>
<ul> <ul>
<li> @switch(\App\Facades\Options::getOption('pw_security_policy'))
{{__('messages.pwsec.line4')}}
</li> @case('low')
<li> <li>A minimum of 10 characters</li>
{{__('messages.pwsec.line5')}} @break
</li>
<li> @case('medium')
{{__('messages.pwsec.line6')}} <li>A minimum of 12 characters;</li>
</li> <li>At least one special character;</li>
<li> <li>Lower case and upper case characters</li>
{{__('messages.pwsec.line7')}} @break
</li>
@case('high')
<li>A minimum of 20 characters;</li>
<li>At least one special character;</li>
<li>Lower case and upper case characters</li>
<li>At least one numerical character</li>
@break
@endswitch
</ul> </ul>
</div> </div>
@endif
<form action="{{ route('register') }}" method="POST" id="registerForm"> <form action="{{ route('register') }}" method="POST" id="registerForm">
@csrf @csrf
<div class="form-group"> <div class="form-group">
@ -54,10 +68,14 @@
<input type="password" id="passwordc" name="password_confirmation" class="form-control" placeholder="{{__('messages.sronly_confirmpassword')}}" /> <input type="password" id="passwordc" name="password_confirmation" class="form-control" placeholder="{{__('messages.sronly_confirmpassword')}}" />
</div> </div>
@if(\App\Facades\Options::getOption('requireGameLicense') && \App\Facades\Options::getOption('currentGame') == 'MINECRAFT')
<div class="form-group mt-5"> <div class="form-group mt-5">
<label for="mcusername" class="sr-only">{{__('messages.sronly_mcusername')}}</label> <label for="mcusername" class="sr-only">{{__('messages.sronly_mcusername')}}</label>
<input type="text" name="uuid" class="form-control" id="mcusername" placeholder="{{__('messages.sronly_mcusername')}}" /> <input type="text" name="uuid" class="form-control" id="mcusername" placeholder="{{__('messages.sronly_mcusername')}}" />
</div> </div>
@endif
<input name="register" id="register" class="btn btn-block login-btn mb-4" type="submit" value="{{__('messages.register_txt')}}"> <input name="register" id="register" class="btn btn-block login-btn mb-4" type="submit" value="{{__('messages.register_txt')}}">
</form> </form>
<p class="login-card-footer-text">{{__('messages.have_account')}} <a href="{{ route('login') }}" class="text-reset">{{__('messages.login_here')}}</a></p> <p class="login-card-footer-text">{{__('messages.have_account')}} <a href="{{ route('login') }}" class="text-reset">{{__('messages.login_here')}}</a></p>

View File

@ -90,6 +90,26 @@
</div> </div>
@if($security['secPolicy'] == 'off')
<div class="row">
<div class="col">
<div class="alert alert-danger">
<p><b><i class="fas fa-exclamation-triangle"></i> DANGER: </b> Insecure security policy</p>
<p>Your current password security policy is set to <b>off</b>. This allows users to choose potentially unsafe passwords.</p>
<p>We strongly recommend you update this value to <b>Low</b> or <b>Medium</b>.</p>
</div>
</div>
</div>
@endif
<div class="row"> <div class="row">