From 52de63e7bbd500a90a1a8cb62cdb490b0ba623c7 Mon Sep 17 00:00:00 2001
From: Unknown <joe2010xtmf@163.com>
Date: Thu, 13 Mar 2014 16:21:16 -0400
Subject: [PATCH] Allow 1 letter usernames

---
 modules/auth/auth.go       | 4 ++--
 public/js/app.js           | 1 -
 templates/user/signup.tmpl | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/auth/auth.go b/modules/auth/auth.go
index b085527554..0e87168891 100644
--- a/modules/auth/auth.go
+++ b/modules/auth/auth.go
@@ -23,7 +23,7 @@ type Form interface {
 }
 
 type RegisterForm struct {
-	UserName     string `form:"username" binding:"Required;AlphaDash;MinSize(5);MaxSize(30)"`
+	UserName     string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
 	Email        string `form:"email" binding:"Required;Email;MaxSize(50)"`
 	Password     string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
 	RetypePasswd string `form:"retypepasswd"`
@@ -59,7 +59,7 @@ func (f *RegisterForm) Validate(errors *binding.Errors, req *http.Request, conte
 }
 
 type LogInForm struct {
-	UserName string `form:"username" binding:"Required;AlphaDash;MinSize(5);MaxSize(30)"`
+	UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
 	Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
 }
 
diff --git a/public/js/app.js b/public/js/app.js
index 69d21020e8..0f0ecc43ea 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -78,7 +78,6 @@ function initRegister() {
             rules: {
                 "username": {
                     required: true,
-                    minlength: 5,
                     maxlength: 30
                 },
                 "email": {
diff --git a/templates/user/signup.tmpl b/templates/user/signup.tmpl
index ba41b0c9bb..2f1e82c730 100644
--- a/templates/user/signup.tmpl
+++ b/templates/user/signup.tmpl
@@ -7,7 +7,7 @@
 		<div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}">
 			<label class="col-md-4 control-label">Username: </label>
 			<div class="col-md-6">
-				<input name="username" class="form-control" placeholder="Type your username" value="{{.username}}" required="required" title="Username must contain at least 5 characters">
+				<input name="username" class="form-control" placeholder="Type your username" value="{{.username}}" required="required">
 			</div>
 		</div>