Skip to content

Commit 31272e6

Browse files
committed
add ambrosia-container to registration form as honeypot for bots: new form field "username" must not be filled
1 parent 1b1cb18 commit 31272e6

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

app/Access/Controllers/RegisterController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ protected function validator(array $data): ValidatorContract
8787
'name' => ['required', 'min:2', 'max:100'],
8888
'email' => ['required', 'email', 'max:255', 'unique:users'],
8989
'password' => ['required', Password::default()],
90+
'username' => ['prohibited'], // this is a honeypot for bots that must not be filled in
9091
]);
9192
}
9293
}

resources/sass/_forms.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,17 @@ input[type=color] {
389389
}
390390
}
391391

392+
.form-group.ambrosia-container, .form-group.ambrosia-container * {
393+
position:absolute;
394+
height:0px !important;
395+
width:0px !important;
396+
margin:0 !important;
397+
padding:0 !important;
398+
background:transparent !important;
399+
color:transparent !important;
400+
border:none !important;
401+
}
402+
392403
.title-input input[type="text"] {
393404
display: block;
394405
width: 100%;

resources/views/auth/register.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<form action="{{ url("/register") }}" method="POST" class="mt-l stretch-inputs">
1414
{!! csrf_field() !!}
1515

16+
<div class="form-group ambrosia-container">
17+
<label for="name">{{ trans('auth.name') }}</label>
18+
@include('form.text', ['name' => 'username'])
19+
</div>
20+
1621
<div class="form-group">
1722
<label for="name">{{ trans('auth.name') }}</label>
1823
@include('form.text', ['name' => 'name'])

0 commit comments

Comments
 (0)