Exemple #1
0
 /**
  * Tests the valid::email_rfc() function.
  * @dataProvider email_rfc_provider
  * @group core.helpers.valid.email_rfc
  * @test
  */
 public function email_rfc($input_email, $expected_result)
 {
     $result = valid::email_rfc($input_email);
     $this->assertEquals($expected_result, $result);
 }
Exemple #2
0
 public function valid_email_rfc_test()
 {
     $this->assert_true_strict(valid::email_rfc('address@domain'))->assert_false_strict(valid::email_rfc('address.domain'));
 }
Exemple #3
0
 /**
  * Enregistrement d'un utilisateur.
  *
  * @return  void
  */
 public function register()
 {
     if (Auth::instance()->logged_in()) {
         return url::redirect(cookie::get('urlAdminUrl') . '?msg=' . urlencode(Kohana::lang('logger.identify')));
     } elseif ($_POST) {
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $tmpUsername = explode('@', $username);
         $tmpUsername = $tmpUsername[0];
         $user = ORM::factory('user', $username);
         if (!$username || !$password) {
             $txt = Kohana::lang('logger.error_all_form');
         } elseif (!valid::email($username) || !valid::email_domain($username) || !valid::email_rfc($username)) {
             $txt = Kohana::lang('logger.error_mail_valid');
         } elseif (User_Model::verification_mail($username)) {
             $txt = Kohana::lang('logger.exist_email');
         } elseif ($user->loaded) {
             $txt = Kohana::lang('logger.exist_username');
         } elseif ($user->insert(array('username' => $tmpUsername, 'x' => Kohana::config('game.initialPosition.x'), 'y' => Kohana::config('game.initialPosition.y'), 'z' => Kohana::config('game.initialPosition.z'), 'region_id' => Kohana::config('game.initialPosition.region'), 'speed' => Kohana::config('game.initialSpeed'), 'gravity' => Kohana::config('game.initialGravity'), 'password' => Auth::instance()->hash_password($password), 'last_login' => date::Now(), 'argent' => 0, 'hp' => Kohana::config('game.initialHP'), 'hp_max' => Kohana::config('game.initialHP'), 'email' => $username, 'ip' => $_SERVER['REMOTE_ADDR']))) {
             Auth::instance()->login($username, $password);
             $from = Kohana::config('game.name') . ' <' . Kohana::config('email.from') . '>';
             $subject = Kohana::lang('logger.title_mail_register', Kohana::config('game.name'));
             $message = Kohana::lang('logger.content_mail_register', $username, $username, $password);
             email::send($username, $from, $subject, $message, TRUE);
             return url::redirect('?msg=' . urlencode(Kohana::lang('logger.identify')));
         } else {
             $txt = Kohana::lang('logger.error_register');
         }
     } else {
         $txt = Kohana::lang('logger.no_acces');
     }
     return self::redirection($txt);
 }