當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validator::noWhitespace方法代碼示例

本文整理匯總了PHP中Respect\Validation\Validator::noWhitespace方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validator::noWhitespace方法的具體用法?PHP Validator::noWhitespace怎麽用?PHP Validator::noWhitespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Respect\Validation\Validator的用法示例。


在下文中一共展示了Validator::noWhitespace方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postChangePassword

 public function postChangePassword($request, $response)
 {
     $validation = $this->validator->validate($request, ['password_old' => v::noWhitespace()->notEmpty()->matchesPassword($this->auth->user()->password), 'password' => v::noWhitespace()->notEmpty()]);
     if ($validation->failed()) {
         return $response->withRedirect($this->router->pathFor('auth.password.change'));
     }
     $this->auth->user()->setPassword($request->getParam('password'));
     $this->flash->addMessage('info', 'Your password was changed');
     return $response->withRedirect($this->router->pathFor('home'));
 }
開發者ID:havenshen,項目名稱:slim-born,代碼行數:10,代碼來源:PasswordController.php

示例2: postSignUp

 public function postSignUp($request, $response)
 {
     $validation = $this->validator->validate($request, ['email' => v::noWhitespace()->notEmpty()->email()->emailAvailable(), 'name' => v::noWhitespace()->notEmpty()->alpha(), 'password' => v::noWhitespace()->notEmpty()]);
     if ($validation->failed()) {
         return $response->withRedirect($this->router->pathFor('auth.signup'));
     }
     $user = User::create(['email' => $request->getParam('email'), 'name' => $request->getParam('name'), 'password' => password_hash($request->getParam('password'), PASSWORD_DEFAULT)]);
     $this->flash->addMessage('info', 'You have been signed up');
     $this->auth->attempt($user->email, $request->getParam('password'));
     return $response->withRedirect($this->router->pathFor('home'));
 }
開發者ID:havenshen,項目名稱:slim-born,代碼行數:11,代碼來源:AuthController.php

示例3: isValidPassword

 public static function isValidPassword($password)
 {
     return v::noWhitespace()->length(8)->validate($password);
 }
開發者ID:enpowi,項目名稱:enpowi,代碼行數:4,代碼來源:User.php

示例4: validateServer

 /**
  * @brief Validate the server
  *
  * @param string $server
  */
 private function validateServer($server)
 {
     $validate_server = Validator::noWhitespace()->alnum('.-_')->length(6, 40);
     return $validate_server->validate($server);
 }
開發者ID:Anon215,項目名稱:movim,代碼行數:10,代碼來源:Groups.php

示例5:

if (!empty($_POST)) {
    //If the Post is not empty, it means that it is an insert from the add form
    $userNameError = null;
    $passwordError = null;
    $unidadeError = null;
    $nameError = null;
    $emailError = null;
    //getting POST data
    $userName = $_POST[username];
    $password = $_POST[password];
    $unidade = $_POST[unidade];
    $name = $_POST[name];
    $email = $_POST[email];
    //Validation using respect/validation
    $valid = true;
    if (!v::noWhitespace()->length(4, 20)->notEmpty()->validate($userName)) {
        $userNameError = "Por favor digite novamente o nome de usuário, entre 4 e 20 caracteres, sem espaços em branco";
        $valid = false;
    }
    if (!v::notEmpty()->validate($password)) {
        $passwordError = "Por favor digite a senha não pode ficar em branco";
        $valid = false;
    }
    if (!v::notEmpty()->length(1, 5)->validate($unidade)) {
        $unidadeError = "Por favor digite novamente o unidade, no formato A-00 (letra, traço e número)";
        $valid = false;
    }
    if (!v::length(3, 80)->notEmpty()->validate($name)) {
        $nameError = "Por favor digite novamente o nome do morador, entre 3 e 80 caracteres";
        $valid = false;
    }
開發者ID:xumes,項目名稱:condominio,代碼行數:31,代碼來源:create.php

示例6: PostChangePassword

 public function PostChangePassword($request, $response)
 {
     // matchesPassword() is a custom validation rule, see Classes/Validation
     // using $this->container->auth->user() as its parameter is a
     // preparation for cases when user's password can be reset by an admin
     // as well (not only the user himselft)
     $validation = $this->container->validator->validate($request, ['password_old' => v::noWhitespace()->notEmpty()->matchesPassword($this->container, $this->container->auth->user()), 'password' => v::noWhitespace()->notEmpty()]);
     // on validation failure redirect back to the form. the rest of this
     // function won't get exectuted
     if ($validation->failed()) {
         return $response->withRedirect($this->container->router->pathFor('auth.password.change'));
     }
     // change the password, emit flash message and redirect
     // TODO error handling on failed db->update
     $user_id = $_SESSION['user'] ?? false;
     if ($user_id) {
         $password = $request->getParam('password');
         $this->container->db->where('id', $user_id);
         $this->container->db->update('users', array('password' => password_hash($password, PASSWORD_DEFAULT)));
         $this->container->flash->addMessage('info', 'Your password was changed');
         return $response->withRedirect($this->container->router->pathFor('home'));
     }
 }
開發者ID:Vaizard,項目名稱:Glued,代碼行數:23,代碼來源:AuthController.php

示例7: validNowhitespace

 /**
  * Verifica se o valor não possui espaços, quebras de linha e tabs
  * @param string $value
  * @return boolean
  */
 public function validNowhitespace($value)
 {
     if (!v::noWhitespace()->validate($value)) {
         Factory::log()->warn('Valor não pode possuir espaços e quebras de linha');
         return false;
     }
     return true;
 }
開發者ID:diego3,項目名稱:myframework-core,代碼行數:13,代碼來源:DatatypeStringBase.php


注:本文中的Respect\Validation\Validator::noWhitespace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。