/** * @covers AppBundle\Entity\User::setSalt * Implement testSetSalt(). */ public function testSetSalt() { $this->assertNotEmpty($this->user->getSalt()); $this->user->setSalt("salt2"); $this->assertNotEmpty($this->user->getSalt()); $this->assertEquals("salt2", $this->user->getSalt()); }
public function executeNewuser(sfWebRequest $request) { $this->form = new UserForm(); // check if the data is coming from POST method if ($request->isMethod('post')) { // bind the form $this->form->bind($request->getParameter($this->form->getName())); $captcha = new reCaptcha(); $responsecaptcha = $captcha->recaptcha_check_answer($_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); //check capcha if (!$responsecaptcha->is_valid) { $this->getUser()->setFlash('message', 'Invalid Sequrity Code,Please enter again'); } else { $formData = $this->form->getValues(); $checkUsernameAndEmail = Doctrine::getTable('User')->func_checkUsernameAndEmail($formData['email_address'], $formData['username']); if (count($checkUsernameAndEmail)) { $this->getUser()->setFlash('message', 'UserName or Email is already taken'); } else { $user = new User(); $user->setUsername($formData['username']); $getSalt = Doctrine::getTable('User')->func_generateSalt(); $getPassword = Doctrine::getTable('User')->func_generatePassword($getSalt, $formData['pass']); $user->setSalt($getSalt); $user->setPass($getPassword); $user->setIsActive(0); $user->setFirstName($formData['first_name']); $user->setLastName($formData['last_name']); $user->setEmailAddress($formData['email_address']); $user->save(); Doctrine::getTable('User')->func_sendVerificationEmail($formData['first_name'], $formData['email_address'], $getSalt); $this->getUser()->setFlash('message', 'Thanks for registration. Account activation link has been sent into your email address.'); $this->redirect('@login'); } // if the username and email does not exist } } // check if the method is POST }
static function importFixture() { $settings = Vars::getSettings(); // import user fixture from "role.yml" if (User::tableExist() && isset($settings['users'])) { foreach ($settings['users'] as $user) { $u = new User(); $u->setEmail($user['email']); $u->setName($user['name']); $u->setPassword($user['password']); $u->setSalt($user['salt']); $roles = array(); foreach ($user['role'] as $role) { $roles[] = $role; } $u->setRole(implode(',', $roles)); $u->save(); } } }
foreach ($ips as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP)) { $path[] = $ip; } } return array_pop($path); } else { if (filter_var($fwd, FILTER_VALIDATE_IP) && !$trustremote && $checkforwarded) { // single return $fwd; } else { // as usual return $remote; } } } } } // Make our class available automatically $user = new User(); $user->setDebug($debug); $user->setLog($log); $user->setMysql($mysqli); $user->setSalt($config['SALT']); $user->setSmarty($smarty); $user->setConfig($config); $user->setMail($mail); $user->setToken($oToken); $user->setBitcoin($bitcoin); $user->setSetting($setting); $user->setErrorCodes($aErrorCodes);
$path = array(); foreach ($ips as $ip) { if (filter_var($ip, FILTER_VALIDATE_IP)) { $path[] = $ip; } } return array_pop($path); } else { if (filter_var($fwd, FILTER_VALIDATE_IP) && !$trustremote && $checkforwarded) { // single return $fwd; } else { // as usual return $remote; } } } } } // Make our class available automatically $user = new User(); $user->setDebug($debug); $user->setMysql($mysqli); $user->setSalt(SALT); $user->setSmarty($smarty); $user->setConfig($config); $user->setMail($mail); $user->setToken($oToken); $user->setBitcoin($bitcoin); $user->setSetting($setting); $user->setErrorCodes($aErrorCodes);
$User = $Users[0]; } else { header('location:index.php'); exit; } $_SESSION['UserSalt'] = $User->getSalt(); } else { $User = new User(NULL, $lang->g('LabelNewUser')); } if (array_key_exists('hidAction', $_POST) && $_POST['hidAction'] == 'UserView') { if (array_key_exists('txtUserName', $_POST)) { $User->setUserName(Utils::NullIfEmpty($_POST['txtUserName'])); } if (array_key_exists('hidPassword', $_POST)) { $User->setPassword(Utils::NullIfEmpty($_POST['hidPassword'])); $User->setSalt(Utils::NullIfEmpty($_SESSION['UserSalt'])); } $User->setFirstName(Utils::NullIfEmpty($_POST['txtFirstName'])); $User->setInsertion(Utils::NullIfEmpty($_POST['txtInsertion'])); $User->setLastName(Utils::NullIfEmpty($_POST['txtLastName'])); $User->setEmailAddress(Utils::NullIfEmpty($_POST['txtEmailAddress'])); $User->setLanguage(Utils::NullIfEmpty($_POST['selectLanguage'])); $User->setDateDisplayOptions($_POST['selectDateformat']); $User->setImageview(Utils::NullIfEmpty($_POST['selectImageview'])); if ($CurrentUser->hasPermission(RIGHT_USER_RIGHTS)) { $getrights = array(); foreach (Rights::getDefinedRights() as $k => $v) { if (array_key_exists('chk' . $k, $_POST)) { $getrights[] = $v; } }