修改登录时用户名长度限制

This commit is contained in:
Li Jianxuan 2014-03-03 04:47:56 +00:00
parent b81b97f910
commit 5eac2e81d0
2 changed files with 6 additions and 8 deletions

View File

@ -25,15 +25,13 @@
</ul>
</li>
<li class="dropdown" id="collapseSys">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i> 设置<b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i> 系统管理<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="<?= $this->url('admin',array('controller'=>'system','action'=>'files')) ?>">文件管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'system','action'=>'config')) ?>">配置管理</a></li>
<li class="divider"></li>
<li><a href="<?= $this->url('admin',array('controller'=>'system','action'=>'search')) ?>">搜索</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'users','action'=>'files')) ?>">用户管理</a></li>
<li><a href="<?= $this->url('admin',array('controller'=>'users','action'=>'config')) ?>">邮件模板</a></li>
</ul>
</li>
<li><a href="http://www.sunflowercms.com/help"><i class="icon-book"></i> 帮助</a></li>
</ul>
<?php $user = \Sookon\Helpers\View::User(); ?>
<ul class="nav navbar-nav user_menu pull-right">

View File

@ -36,9 +36,9 @@ class LoginHandle implements \Sookon\User\Event\LoginEvent
if(!empty($data[$this->conf->field->uname]))
{
if(!preg_match("/^[a-zA-Z][a-zA-Z0-9_]{4,15}$/",$data[$this->conf->field->uname]))
if(!preg_match("/^[a-zA-Z][a-zA-Z0-9_]{2,15}$/",$data[$this->conf->field->uname]))
{
return array('error'=>"用户名应当以字母开头,由字母数字和下划线组成,并且长度在5到25个字符之间",'place'=>'username');
return array('error'=>"用户名应当以字母开头,由字母数字和下划线组成,并且长度在2到25个字符之间",'place'=>'username');
}
}