/** * Register page action * POST-request after form submit */ public function postRegister() { $this->app->log->debug(get_class($this) . '->postRegister()'); // clean the input $user_email = strip_tags($this->app->request->post('user_email')); $user_name = null; // strip_tags($this->app->request->post('user_name')); if (!$user_name) { // Se non specificato, utilizzo l'indirizzo email come username $user_name = $user_email; } $user_email_repeat = NULL; // potrei usare strip_tags($this->app->request->post('user_email_repeat')); $user_password_new = $this->app->request->post('user_password_new'); $user_password_repeat = $this->app->request->post('user_password_repeat'); $captcha = $this->app->request->post('g-recaptcha-response'); $redirect = ltrim(urldecode($this->app->request->post('redirect'))); $registration_successful = RegistrationModel::registerNewUser($user_name, $user_email, $user_email_repeat, $user_password_new, $user_password_repeat, $captcha, UserModel::PROVIDER_TYPE_DEFAULT); if ($registration_successful) { $login_successful = LoginModel::login($user_name, $user_password_new, true, UserModel::PROVIDER_TYPE_DEFAULT); $this->redirectAfterLogin($login_successful); } else { $app->redirect($app->config('app.baseurl') . '/register'); } }