本文整理汇总了PHP中AuthManager::createUser方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthManager::createUser方法的具体用法?PHP AuthManager::createUser怎么用?PHP AuthManager::createUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthManager
的用法示例。
在下文中一共展示了AuthManager::createUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processImpl
protected function processImpl(PostArrayAdapter $adapter, $button)
{
$data = new RegFormData();
/*
* Имя пользователя
*/
$name = $adapter->str(FORM_PARAM_REG_NAME);
$error = UserInputValidator::validateShortText($name);
if ($error) {
return array(FORM_PARAM_REG_NAME => $error);
}
$name = UserInputTools::safeShortText($name);
$data->setUserName($name);
/*
* e-mail
*/
$mail = $adapter->str(FORM_PARAM_REG_MAIL);
$error = UserInputValidator::validateEmail($mail);
if ($error) {
return array(FORM_PARAM_REG_MAIL => $error);
}
$data->setUserMail($mail);
/*
* Пол
*/
$sex = $adapter->int(FORM_PARAM_REG_SEX);
$error = UserInputValidator::validateSex($sex);
if ($error) {
return array(FORM_PARAM_REG_SEX => $error);
}
$data->setSex($sex);
/*
* Пароль
*/
$pass = $adapter->str(FORM_PARAM_REG_PASS);
$passConfirm = $adapter->str(FORM_PARAM_REG_PASS_CONF);
$error = UserInputValidator::validatePass($pass, $passConfirm);
if ($error) {
return array(FORM_PARAM_REG_PASS => $error);
}
$error = UserInputValidator::validatePassConfirm($pass, $passConfirm);
if ($error) {
return array(FORM_PARAM_REG_PASS_CONF => $error);
}
$data->setPassword($pass);
AuthManager::createUser($data);
return new AjaxSuccess();
}