public function testShouldSetSecureUserPassword() { $user = User::find_by_name('NeechyUser'); $password = '******'; $user->set_password($password); $this->assertTrue(NeechySecurity::verify_password($password, $user->field('password'))); }
public function testHashPassword() { $password = '******'; $stored_hash = NeechySecurity::hash_password($password); $verified = NeechySecurity::verify_password($password, $stored_hash); $this->assertTrue($verified); $unverified = NeechySecurity::verify_password("don't remember", $stored_hash); $this->assertFalse($unverified); }
public function authenticate_user_password() { $key = 'authenticate'; $message = 'Password is incorrect. Please try again.'; if (!NeechySecurity::verify_password($this->value, $this->user->field('password'))) { $this->add_error('authenticate', $message); return false; } else { return true; } }
private function authenticate_user_password() { $form_key = 'login-pass'; $value = $this->request->post($form_key, ''); # Rules if ($this->string_is_empty($value)) { $message = 'Enter your password'; $this->add_error($form_key, $message); throw new LoginException($message); } if (NeechySecurity::verify_password($value, $this->user->field('password'))) { return TRUE; } else { $this->add_error($form_key, self::FAILURE_MESSAGE); throw new LoginException(self::FAILURE_MESSAGE); } }