commit 57295af06edc43e3285dc418c5a7a6b528a32201 Author: smarcet Date: Mon Oct 12 12:37:29 2020 -0300 Added code of conduct Change-Id: I69c3218e14a8f65caa482df204625cb254ba2a74 Signed-off-by: smarcet diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 9c8dce9..598c465 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 a09822b..005e49b 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 4e35047..5e654d6 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 c69b897..42e89ff 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 b8ea35f..8840e42 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 +