当前位置: 首页>>代码示例>>PHP>>正文


PHP Authentication::createUser方法代码示例

本文整理汇总了PHP中Authentication::createUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::createUser方法的具体用法?PHP Authentication::createUser怎么用?PHP Authentication::createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Authentication的用法示例。


在下文中一共展示了Authentication::createUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createAlumno

 public function createAlumno(array $post)
 {
     //var_dump($post);
     //Sanitisar los valores enviados por el usuario ( POST )
     $username = filter_var($post['username_input_data'], FILTER_SANITIZE_STRING);
     $mail = filter_var($post['email_input_data'], FILTER_SANITIZE_EMAIL);
     $password = filter_var($post['password_input_data'], FILTER_SANITIZE_STRING);
     $username = strip_tags($username);
     $mail = strip_tags($mail);
     $password = strip_tags($password);
     //Validar el email
     $mail = filter_var($mail, FILTER_VALIDATE_EMAIL);
     $longitudPass = strlen($password);
     $perfil = Perfil::where('email', '=', $mail)->get();
     //Verificar que el email sea valido
     if (!$mail) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=1');
     }
     //Verificar la longitud del password
     if ($longitudPass < 8) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=2');
     }
     //Verificar que el email no exista en la base de datos (Perfil)
     if (count($perfil) > 0) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=3');
     }
     //Verificar que el username no exista en la base de datos
     $perfil = Perfil::where('username', '=', $username)->get();
     if (count($perfil) > 0) {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=4');
     }
     $user = Authentication::createUser($username, $mail, $password, 4);
     if ($user) {
         if (isset($_SESSION['proceso']) && ($_SESSION['proceso']['proceso'] = 1)) {
             $this->app->redirect('/suscribirme/' . $_SESSION['proceso']['curso']);
         } else {
             $this->app->redirect('/' . $username);
         }
     } else {
         $this->app->redirect($this->app->urlFor('join') . '?attempt=5');
     }
 }
开发者ID:CodeSomethingMX,项目名称:barney,代码行数:42,代码来源:AlumnoController.class.php

示例2: Authentication

    }
    if (!preg_match("#[a-z]+#", $password)) {
        $error .= "Password must include at least one letter!<br />";
    }
    if (!preg_match("#[A-Z]+#", $password)) {
        $error .= "Password must include at least one CAPS!<br />";
    }
    //if( !preg_match("#\W+#", $password) ) {
    //	$error .= "Password must include at least one symbol!<br />";
    //}
    if (!empty($error)) {
        $app->flash('error', $error);
        $app->redirect('/create/new/user');
    }
    $auth = new Authentication($email, $password);
    if (!$auth->createUser($first_name, $last_name, $company, $phone, $group)) {
        $app->flash('error', $error . "<br />" . $auth->getError());
        $app->redirect('/create/new/user');
    }
    $_SESSION['user'] = $email;
    $app->redirect('/');
});
$app->get("/forgotpassword", function () use($app) {
    $flash = $app->view()->getData('flash');
    $error = "";
    echo "error: " . $flash['error'];
    if (isset($flash['error'])) {
        $error = $flash['error'];
    }
    $app->render("Authentication/Forgotpassword.php", array('error' => $error));
});
开发者ID:kxopa,项目名称:Slim-PHP-Authentication-App,代码行数:31,代码来源:Authentication.php


注:本文中的Authentication::createUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。