本文整理汇总了PHP中app\models\Users::sendMailCheck方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::sendMailCheck方法的具体用法?PHP Users::sendMailCheck怎么用?PHP Users::sendMailCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Users
的用法示例。
在下文中一共展示了Users::sendMailCheck方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resend
public function resend($id)
{
$this->checker('update_full_admin');
$user = Users::select()->where('id', $id)->get();
if (empty($user)) {
Router::redirect('home.index');
}
$user = $user[0];
$user->mail_check = sha1($user->user_key . '-----' . time());
$user->mail_check_at = BaseModel::now();
$user->save();
Users::sendMailCheck($user);
Router::redirect('admin:user.show');
}
示例2: register
public function register()
{
Users::redirectIf(true);
$nickname = Helper::post('nickname');
$password = Helper::post('password');
$confirm = Helper::post('password_confirm');
$email = Helper::post('email');
if (empty($nickname) || empty($password) || empty($confirm) || empty($email)) {
Session::setFlash('danger', '', Translate::get('error.forms.missing.content'));
Router::redirect('user.signup');
}
$errors = [];
if (strlen($nickname) < 3 || strlen($nickname) > 40) {
$errors['username'] = Translate::get('register.error.username');
}
if (!preg_match('#[a-zA-Z0-9\\_\\.]+#', $nickname)) {
$errors['username'] = Translate::get('register.error.username');
}
if (strlen($password) < 6) {
$errors['password'] = Translate::get('register.error.password');
}
if ($password != $confirm) {
$errors['password'] = Translate::get('register.error.password_confirm');
}
if (!preg_match('/[a-zA-Z0-9\\_\\-\\.]{3,}@[a-zA-Z0-9\\-]{2,}\\.[a-z]{2,6}/', $email)) {
$errors['email'] = Translate::get('register.error.email');
}
if (!empty($errors)) {
ob_start();
Translate::getContent('error_fields', ['errors' => $errors]);
$content = ob_get_clean();
Session::setFlash('danger', '', $content);
Router::redirect('user.signup');
}
$users = Users::select()->addFields(['id'])->where('nickname', $nickname)->andWhere('mail', $email)->get(0, 1);
if (!empty($users)) {
Session::setFlash('danger', '', Translate::get('user.error.register'));
Router::redirect('user.signup');
}
$random = '';
while ($random == '') {
$random = Config::randomString(14);
if (Users::find('user_key', $random)) {
$random = '';
}
}
$default_group = Groups::find('g_default', 1);
$user = Users::create();
$user->id_group = $default_group->id;
// TODO: Change for default group
$user->nickname = $nickname;
$user->password = password_hash($password, PASSWORD_BCRYPT);
$user->user_key = $random;
$user->mail = $email;
$user->mail_check = sha1($user->user_key);
$user->mail_check_at = BaseModel::now();
$user->register_at = BaseModel::now();
$user->connection_at = '0000-00-00 00:00:00';
$user->save();
Users::sendMailCheck($user);
Session::setFlash('success', '', Translate::get('user.success.register'));
Router::redirect('home.index');
}