diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 9c8dce91..598c4651 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -15,6 +15,7 @@ use App\Http\Controllers\Controller; use App\Http\Utils\CountryList; use App\Services\Auth\IUserService; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\Validator; @@ -149,14 +150,20 @@ final class RegisterController extends Controller */ protected function validator(array $data) { - return Validator::make($data, [ + $rules = [ 'first_name' => 'required|string|max:100', 'last_name' => 'required|string|max:100', 'country_iso_code' => 'required|string|country_iso_alpha2_code', 'email' => 'required|string|email|max:255', 'password' => 'required|string|confirmed|password_policy', 'g-recaptcha-response' => 'required|recaptcha', - ]); + ]; + + if(!empty(Config::get("app.code_of_conduct_link", null))){ + $rules['agree_code_of_conduct'] = 'required|string|in:on'; + } + + return Validator::make($data, $rules); } /** diff --git a/config/app.php b/config/app.php index a09822b6..005e49b7 100644 --- a/config/app.php +++ b/config/app.php @@ -220,9 +220,10 @@ return [ ], 'version' => env('APP_VERSION', 'XX.XX.XX'), - 'app_name' => env('APP_NAME', 'OpenStackId'), + 'app_name' => env('APP_NAME', 'OpenStackID'), 'tenant_name' => env('TENANT_NAME', 'OpenStack'), 'logo_url' => env('LOGO_URL', '/assets/img/openstack-logo-full.svg'), 'tenant_favicon' => env('TENANT_FAV_ICON_URL', '/assets/img/favicon-32x32.png'), - 'help_email' => env('HELP_EMAIL', 'support@openstack.org') + 'help_email' => env('HELP_EMAIL', 'support@openstack.org'), + 'code_of_conduct_link' => env("CODE_OF_CONDUCT_LINK","https://www.openstack.org/legal/community-code-of-conduct"), ]; diff --git a/public/assets/css/auth/register.css b/public/assets/css/auth/register.css index 4e350475..5e654d60 100644 --- a/public/assets/css/auth/register.css +++ b/public/assets/css/auth/register.css @@ -91,4 +91,9 @@ body{ } .signup-form form a:hover{ text-decoration: underline; +} + +.agree_code_of_conduct a { + color: #337ab7 !important; + text-decoration: none !important; } \ No newline at end of file diff --git a/public/assets/js/auth/registration.js b/public/assets/js/auth/registration.js index c69b8970..42e89ffd 100644 --- a/public/assets/js/auth/registration.js +++ b/public/assets/js/auth/registration.js @@ -48,6 +48,7 @@ minlength: 8, equalTo : "#password" }, + 'agree_code_of_conduct': {required: true}, 'g_recaptcha_hidden': {required: true} }, messages: { diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index b8ea35f2..8840e426 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -84,12 +84,22 @@
+ The password must be 8–30 characters, and must include a special character.
{!! Recaptcha::render(['id'=>'captcha', 'class'=>'input-block-level', 'callback'=>'verifyCaptchaCallback']) !!}
+ + @if(Config::get("app.code_of_conduct_link")) +
+ +
+ @endif +