password resets

This commit is contained in:
Conkley 2022-07-24 19:59:23 +10:00
parent 47772979ce
commit daa283a4d4
5 changed files with 78 additions and 101 deletions

View File

@ -27,4 +27,18 @@ class ResetPasswordController extends Controller
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Get the password reset validation rules.
*
* @return array
*/
protected function rules()
{
return [
'token' => 'required',
'email' => 'required|email',
'password' => ['required', 'string', 'min:8', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{6,}$/'],
];
}
}

View File

@ -43,14 +43,13 @@
@endif
<h3>Password</h3>
<input id="password" type="password" name="password" required autocomplete="current-password">
<p class="important">Don't forget your password! Passwords are currently non-recoverable.</p>
@error('password')
<span style="color:red" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
<br>
<input style="width:5%;margin-bottom:15px" type="checkbox" name="remember" id="remember"
<input style="width:5%;margin-bottom:15px;margin-top:15px" type="checkbox" name="remember" id="remember"
{{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
@ -58,10 +57,10 @@
</label>
<button type="submit" class="greenbutton">Log in!</button>
@if (Route::has('password.request'))
<br>
<br><br>
<a class="btn btn-link" href="{{ route('password.request') }}"
style="text-align:center;display:block;width:90%">
{{ __('Forgot Your Password?') }}
Forgot Your Password?
</a>
@endif
</form>

View File

@ -1,47 +1,34 @@
@extends('layouts.app')
@section('title')
<title>Reset Password - {{ env('APP_NAME') }}</title>
@endsection
@section('alert')
@if (session('status'))
<div id="alert"
style="background:linear-gradient(0deg,#02b757 0%,#118237 49%,#01a64e 50%,#3fc679 95%,#a3e2bd 100%)"
role="alert">
{{ session('status') }}
</div>
@endif
@endsection
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<h1>Reset Password</h1>
<form method="POST" action="{{ route('password.email') }}">
@csrf
<h3>Email Address</h3>
<input id="email" type="email" name="email" value="{{ old('email') }}" required autocomplete="email"
placeholder="Email address..." autofocus>
@error('email')
<span class="warningtext" role="alert">
<br><strong>{{ $message }}</strong>
</span>
@enderror
<br><br>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<form method="POST" action="{{ route('password.email') }}">
@csrf
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<button type="submit" onClick="this.form.submit();this.disabled=true">
Send Password Reset Link
</button>
</form>
@endsection

View File

@ -1,65 +1,43 @@
@extends('layouts.app')
@section('title')
<title>Reset Password - {{ env('APP_NAME') }}</title>
@endsection
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<h1>Reset Password</h1>
<p>Passwords must be 8 or more characters, with 1 capital letter, 1 symbol and 1 number.</p><br>
<form method="POST" action="{{ route('password.update') }}">
@csrf
<div class="card-body">
<form method="POST" action="{{ route('password.update') }}">
@csrf
<input type="hidden" name="token" value="{{ $token }}">
<input type="hidden" name="token" value="{{ $token }}">
<h3>Email Address</h3>
<input id="email" type="email" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email"
autofocus>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
@error('email')
<span class="warningtext" role="alert">
<br><strong>{{ $message }}</strong>
</span>
@enderror
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
<h3>New Password</h3>
<input id="password" type="password" name="password" required autocomplete="new-password"
placeholder="Enter your new password">
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
@error('password')
<span class="warningtext" role="alert">
<br><strong>{{ $message }}</strong>
</span>
@enderror
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<h3>Confirm New Password</h3>
<input id="password-confirm" type="password" name="password_confirmation" required autocomplete="new-password"
placeholder="Confirm your new password">
<br><br>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Reset Password') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<button type="submit" onClick="this.form.submit();this.disabled=true">
Reset Password
</button>
</form>
@endsection

View File

@ -75,7 +75,6 @@
<input id="password" type="password" name="password" required autocomplete="password">
<p>Don't reuse passwords, and don't use a simple one!</p>
<p>Passwords must be 8 or more characters, with 1 capital letter, 1 symbol and 1 number.</p>
<p class="important">Don't forget your password! Passwords are currently non-recoverable.</p>
@error('password')
<div class="invalid-feedback" style="color:red">
<strong>{{ $message }}</strong>