public function validate_username(Module_Admin $module, $arg) { $_POST['username'] = $arg = trim($arg); if ($this->user->getVar('user_name') === $arg) { return false; } if (GWF_User::getByName($arg) !== false) { return $this->module->lang('err_username_taken'); } if (!GWF_Validator::isValidUsername($arg)) { return $this->module->lang('err_username'); } return false; }
public static function validate_yournick(Module_Chat $module, $arg) { $arg = trim($arg); $_POST['yournick'] = $arg; if (false === ($oldnick = $module->getNickname())) { # No Nick yet if (!GWF_Validator::isValidUsername($arg)) { # Valid return $module->lang('err_nick_syntax'); } else { if ($module->isNameTaken($module->getGuestPrefixed($arg))) { return $module->lang('err_nick_taken'); } else { return false; } } } if ($oldnick === $arg) { return false; } return $module->lang('err_nick_tamper'); }
/** * Add admin */ public static function wizard_9_1() { $username = Common::getPostString('username', ''); if (!GWF_Validator::isValidUsername($username)) { return GWF_HTML::error('Install Wizard', 'Invalid username.', false) . self::wizard_8(); } $password = Common::getPostString('password', ''); if (!GWF_Validator::isValidPassword($password)) { return GWF_HTML::error('Install Wizard', 'Invalid password (minlength: 6).', false) . self::wizard_8(); } $email = Common::getPostString('email', ''); if (!GWF_Validator::isValidEmail($email)) { return GWF_HTML::error('Install Wizard', 'Invalid email.', false) . self::wizard_8(); } if (false === GWF_InstallFunctions::default_groups()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $back = ''; if (false === GWF_InstallFunctions::createAdmin($username, $password, $email, $back)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $back . self::wizard_btn('9') . self::wizard_btn('10'); }
public function validate_username(Module_Register $module, $arg) { if (false !== GWF_User::getByName($arg)) { return $this->module->lang('err_name_taken'); } if (!GWF_Validator::isValidUsername($arg)) { return $this->module->lang('err_name_invalid'); } return false; }