当前位置: 首页>>代码示例>>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;未经允许,请勿转载。