isEmpty('full_name', Ts::get(63)); $this->isEmpty('email', Ts::get(64)); $this->isNotEmail('email', Ts::get(65)); $this->isExists('email', UserPublic::class, Ts::get(66)); $this->isNotSecurePassword('password', Ts::get(67)); $this->isNotMatch('cPassword', 'password', Ts::get(68)); $this->isNotChecked('has_terms', Ts::get(69)); $this->isNotChecked('has_privacy', Ts::get(197)); //$this->isNotChecked('has_cookies', Ts::get(70)); //$this->isEmpty('g-recaptcha-response', Ts::get(71)); //reCaptcha //$secret = '6LcD2C4hAAAAAMZNC8E0XAoB2nbW29DrFlWPU5vJ'; //$response = $this->data->{'g-recaptcha-response'}; //$remoteip = $_SERVER['REMOTE_ADDR']; //$url = "https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip"; //$data = file_get_contents($url); //$row = json_decode($data, true); $full_name = explode(' ', $this->data->{'full_name'}); $firstName = $full_name[0]; $lastName = $full_name[1] ?? $firstName; //if ($row['success'] == "true") { //Create user into cms database $user = new UserPublic(); $user->email = $this->data->{'email'}; $user->full_name = $this->data->{'full_name'}; //$user->password = $this->data->{'password'}; $user->setPasswordHash($this->data->{'password'}); if ($this->data->{'has_club_card'} == true) $user->club_card = 1; if (!empty($this->data->{'has_double_auth'}) && $this->data->{'has_double_auth'} == true) $user->has_double_auth = 1; if (!empty($this->data->{'has_newsletter'}) && $this->data->{'has_newsletter'} == true) { $user->has_newsletter = 1; PhplistUserUser::add($user->email); } $user->user_agent = $_SERVER['HTTP_USER_AGENT']; if (!empty($_GET['device_id'])) $user->device_id = $_GET['device_id']; $user->date_registered = date('Y-m-d H:i:s'); $user->save(); $requiredActions = []; if (!empty($this->data->{'has_double_auth'}) && $this->data->{'has_double_auth'} == true) { $requiredActions[] = 'CONFIGURE_TOTP'; } $requiredActions[] = 'VERIFY_EMAIL'; //Create user into Identity server $idServer = new IdServer(); $idsResponse = $idServer->customPostRequest('/users', [ 'enabled' => true, 'username' => $this->data->{'email'}, 'email' => $this->data->{'email'}, 'firstName' => $firstName, 'lastName' => $lastName, 'credentials' => [ [ 'type' => 'password', 'value' => $this->data->{'password'}, 'temporary' => false ], ], 'requiredActions' => $requiredActions, //'requiredActions' => [ // 'CONFIGURE_TOTP', // 'VERIFY_EMAIL' //], 'groups' => ['public_user'], 'attributes' => [ 'locale' => 'bg' ] ]); return ['recaptcha-validated' => 1, 'id-server-response' => $idsResponse]; //} } protected function contact() { Ts::set([63, 64, 65]); $this->isEmpty('full_name', Ts::get(63)); $this->isEmpty('email', Ts::get(64)); $this->isNotEmail('email', Ts::get(65)); $html = "