本文整理汇总了PHP中Sentinel::setUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentinel::setUser方法的具体用法?PHP Sentinel::setUser怎么用?PHP Sentinel::setUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentinel
的用法示例。
在下文中一共展示了Sentinel::setUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
break;
/*
|--------------------------------------------------------------------------
| Profile save
|--------------------------------------------------------------------------
|
*/
/*
|--------------------------------------------------------------------------
| Profile save
|--------------------------------------------------------------------------
|
*/
case 'profile_save':
if (@$_POST['regenerate'] === '1') {
Sentinel::setUser($current_user, null, null, null, true);
Sentinel::save();
}
break;
/*
|--------------------------------------------------------------------------
| Unknown action...
|--------------------------------------------------------------------------
|
*/
/*
|--------------------------------------------------------------------------
| Unknown action...
|--------------------------------------------------------------------------
|
*/
示例2: _e
?>
<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>';
}
}
}
}
?>
<form id="authsave" autocomplete="off" method="POST" action="?#passwordtab"><input type="hidden" name="action" value="passwordtab"><div class="container"><div class="row"><div class="input-group col-sm-6 col-md-4" id="usernamegroup" data-toggle="tooltip" data-placement="top" title="<?php
_h('Username is required');
?>
"><span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span> <input type="text" id="username" name="username" class="form-control" value="<?php
echo h(@$_POST['username']);
?>
" placeholder="<?php
_h('Username');