本文整理匯總了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');
}
}
示例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));
});