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


PHP Password::isForbidden方法代碼示例

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


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

示例1: test4

 public function test4()
 {
     $this->assertEquals(Password::isForbidden(' password '), true);
 }
開發者ID:martinlindhe,項目名稱:core_dev,代碼行數:4,代碼來源:PasswordTest.php

示例2: register

 function register($username, $pwd1, $pwd2)
 {
     $error = ErrorHandler::getInstance();
     $username = trim($username);
     $pwd1 = trim($pwd1);
     if (strlen($username) < $this->username_minlen) {
         $error->add('Username must be at least ' . $this->username_minlen . ' characters long');
         return false;
     }
     if (strlen($username) > $this->username_maxlen) {
         $error->add('Username cant be longer than ' . $this->username_maxlen . ' characters long');
         return false;
     }
     if (strlen($pwd1) < $this->password_minlen) {
         $error->add('Password must be at least ' . $this->password_minlen . ' characters long');
         return false;
     }
     if ($pwd1 != $pwd2) {
         $error->add('Passwords dont match');
         return false;
     }
     if ($username == $pwd1) {
         $error->add('Username and password must be different');
         return false;
     }
     if (User::getByName($username)) {
         $error->add('Username taken');
         return false;
     }
     if (ReservedWord::isReservedUsername($username)) {
         $error->add('Username is reserved');
         return false;
     }
     if (Password::isForbidden($pwd1)) {
         $error->add('Your password is a very weak one and is forbidden to use');
         return false;
     }
     $user_id = self::create($username, $pwd1);
     if (!$user_id) {
         $error->add('Failed to create user');
         return false;
     }
     if ($this->post_reg_callback) {
         call_user_func($this->post_reg_callback, $user_id);
     }
     return $user_id;
 }
開發者ID:martinlindhe,項目名稱:core_dev,代碼行數:47,代碼來源:UserHandler.php

示例3:

    echo 'Fb username: ' . UserSetting::get($user->id, 'fb_name') . '<br/>';
    echo 'Fb picture: <img src="' . UserSetting::get($user->id, 'fb_picture') . '"/><br/>';
    $fburl = 'http://www.facebook.com/profile.php?id=' . $user->name;
    echo 'Fb profile: <a href="' . $fburl . '" target="_blank">' . $fburl . '</a><br/>';
}
echo 'Last IP: ' . $user->last_ip . '<br/>';
echo '<br/>';
if ($session->id != $this->owner && isset($_GET['remove'])) {
    if (confirmed('Are you sure you want to remove this user?')) {
        $user->remove();
        echo '<div class="item">User removed</div>';
    }
    return;
}
if (!empty($_POST['change_pwd'])) {
    if (Password::isForbidden($_POST['change_pwd'])) {
        echo '<div class="item">Weak password was chosen, password has not been changed!</div>';
        return;
    }
    UserHandler::setPassword($user->id, $_POST['change_pwd']);
    echo '<div class="item">Password changed!</div>';
    return;
}
if (!empty($_POST['setting_name']) && isset($_POST['setting_val'])) {
    UserSetting::set($user->id, $_POST['setting_name'], $_POST['setting_val']);
    echo '<div class="good">Setting added!</div>';
}
if (!empty($_GET['remove_setting'])) {
    UserSetting::delete($user->id, $_GET['remove_setting']);
    echo '<div class="good">Setting removed!</div>';
}
開發者ID:martinlindhe,項目名稱:core_dev,代碼行數:31,代碼來源:user.php


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