} } else { $validationError = ezpI18n::tr('extension/ngconnect/ngconnect/profile', 'A valid username and password is required to login.'); } } else { if ($http->hasPostVariable('SaveButton') && !$forcedRedirect && $ngConnectINI->variable('ProfileGenerationSettings', 'CreateUser') == 'enabled') { // user wants to connect by creating a new eZ Publish account if ($http->hasSessionVariable('NGConnectStartedRegistration')) { eZDebug::writeWarning('Cancel module run to protect against multiple form submits', 'ngconnect/profile'); $http->removeSessionVariable('NGConnectStartedRegistration'); return eZModule::HOOK_STATUS_CANCEL_RUN; } $http->setSessionVariable('NGConnectStartedRegistration', 1); $validationResult = ngConnectUserActivation::validateUserInput($http); if ($validationResult['status'] == 'success') { $user = ngConnectFunctions::createUser($authResult); if ($user instanceof eZUser) { $login = trim($http->postVariable('data_user_login')); $email = trim($http->postVariable('data_user_email')); $password = trim($http->postVariable('data_user_password')); if (empty($password) && $siteINI->variable('UserSettings', 'GeneratePasswordIfEmpty') == 'true') { $password = $user->createPassword($siteINI->variable('UserSettings', 'GeneratePasswordLength')); } // we created the new account, but still need to set things up so users can login using a regular login form $db = eZDB::instance(); $db->begin(); $user->setAttribute('login', $login); $user->setAttribute('email', $email); $user->setAttribute('password_hash', eZUser::createHash($login, $password, eZUser::site(), eZUser::hashType())); $user->setAttribute('password_hash_type', eZUser::hashType()); $user->store();