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


PHP Sentinel::userExists方法代码示例

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


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

示例1: unset

 $password2 = $_POST['password2'];
 $roles = $_POST['roles'];
 $type = $_POST['add-type'];
 unset($_POST['csrf_token']);
 unset($_POST['action']);
 unset($_POST['username']);
 unset($_POST['password']);
 unset($_POST['password2']);
 unset($_POST['roles']);
 unset($_POST['add-type']);
 $logfiles = $_POST;
 $errors = array();
 if (empty($username)) {
     $errors['username'] = __('Username is required');
 } else {
     if ($type === 'add' && Sentinel::userExists($username)) {
         $errors['username'] = sprintf(__('User %s already exists'), '<code>' . $username . '</code>');
     }
 }
 if ($type === 'edit' && !empty($password) || $type === 'add') {
     if (mb_strlen($password) < 6) {
         $errors['password'] = __('Password must contain at least 6 chars');
     }
     if ($password !== $password2) {
         $errors['password2'] = __('Password confirmation is not the same');
     }
 }
 if (count($errors) === 0) {
     if (empty($password)) {
         $password = null;
     }
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:31,代码来源:users.pml.php

示例2: _h

        ?>
"></div></div></div><br><br><input type="submit" class="btn btn-large btn-success" value="<?php 
        _h('Enable authentication');
        ?>
"></form><?php 
    }
    ?>
</div><div class="tab-pane" id="passwordtab"><?php 
    if (Sentinel::isAuthSet()) {
        ?>
<br><h4><?php 
        _e('Please fill an existing username and a new password');
        ?>
</h4><?php 
        if (@$_POST['action'] === 'passwordtab') {
            if (!Sentinel::userExists($_POST['username'])) {
                echo '<div class="alert alert-danger" role="alert">' . sprintf(__('User %s does not exist!'), '<code>' . $_POST['username'] . '</code>') . '</div>';
            } else {
                if ($_POST['password'] !== $_POST['password2']) {
                    echo '<div class="alert alert-danger" role="alert">' . __('Password confirmation is not the same') . '</div>';
                } else {
                    if (mb_strlen($_POST['password']) < 6) {
                        echo '<div class="alert alert-danger" role="alert">' . __('Password must contain at least 6 chars') . '</div>';
                    } else {
                        Sentinel::setUser($_POST['username'], $_POST['password']);
                        Sentinel::save();
                        echo '<div class="alert alert-success" role="alert">' . sprintf(__('Password has been updated for user %s!'), '<code>' . $_POST['username'] . '</code>') . '</div>';
                    }
                }
            }
        }
开发者ID:abhijith444,项目名称:enroll,代码行数:31,代码来源:test.php


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