Update landing page, add age check

This commit is contained in:
Daniel Supernault 2019-11-22 21:21:53 -07:00
parent 256f6b3515
commit d11e82c3d9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 16 additions and 5 deletions

View file

@ -63,7 +63,7 @@ class RegisterController extends Controller
'unique:users', 'unique:users',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
if (!ctype_alpha($value[0])) { if (!ctype_alpha($value[0])) {
return $fail('Username is invalid. Username must be alpha-numeric and start with a letter.'); return $fail('Username is invalid. Must start with a letter or number.');
} }
$val = str_replace(['_', '-', '.'], '', $value); $val = str_replace(['_', '-', '.'], '', $value);
if(!ctype_alnum($val)) { if(!ctype_alnum($val)) {
@ -73,6 +73,7 @@ class RegisterController extends Controller
]; ];
$rules = [ $rules = [
'agecheck' => 'required|accepted',
'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'), 'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'),
'username' => $usernameRules, 'username' => $usernameRules,
'email' => 'required|string|email|max:255|unique:users', 'email' => 'required|string|email|max:255|unique:users',

View file

@ -75,7 +75,7 @@
</div> </div>
<div class="col-12 col-md-5 offset-md-1"> <div class="col-12 col-md-5 offset-md-1">
<div> <div>
<div class="card my-4"> <div class="card my-4 shadow-none border">
<div class="card-body px-lg-5"> <div class="card-body px-lg-5">
<div class="text-center pt-3"> <div class="text-center pt-3">
<img src="/img/pixelfed-icon-color.svg"> <img src="/img/pixelfed-icon-color.svg">
@ -86,7 +86,7 @@
</div> </div>
<div> <div>
@if(true === config('pixelfed.open_registration')) @if(true === config('pixelfed.open_registration'))
<form class="px-1" method="POST" action="{{ route('register') }}"> <form class="px-1" method="POST" action="{{ route('register') }}" id="register_form">
@csrf @csrf
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
@ -102,7 +102,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<input id="username" type="text" class="form-control{{ $errors->has('username') ? ' is-invalid' : '' }}" name="username" value="{{ old('username') }}" placeholder="{{ __('Username') }}" required> <input id="username" type="text" class="form-control{{ $errors->has('username') ? ' is-invalid' : '' }}" name="username" value="{{ old('username') }}" placeholder="{{ __('Username') }}" required maxlength="15" minlength="2">
@if ($errors->has('username')) @if ($errors->has('username'))
<span class="invalid-feedback"> <span class="invalid-feedback">
@ -141,6 +141,16 @@
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="{{ __('Confirm Password') }}" required> <input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="{{ __('Confirm Password') }}" required>
</div> </div>
</div> </div>
<div class="form-group row">
<div class="col-md-12">
<div class="form-check">
<input class="form-check-input" name="agecheck" type="checkbox" value="true" id="ageCheck" required>
<label class="form-check-label" for="ageCheck">
I am at least 16 years old
</label>
</div>
</div>
</div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold"> <button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">
@ -161,7 +171,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card card-body"> <div class="card shadow-none border card-body">
<p class="text-center mb-0 font-weight-bold">Have an account? <a href="/login">Log in</a></p> <p class="text-center mb-0 font-weight-bold">Have an account? <a href="/login">Log in</a></p>
</div> </div>
</div> </div>