From 249f1beed74a912dad77b4d733ef51d533bd3ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=A4=A7=E5=85=A8?= Date: Wed, 5 Jul 2017 10:56:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=86=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/main.go | 13 +++---------- views/main/index.html | 4 +++- views/main/password.html | 1 - views/main/profile.html | 10 +++++----- 4 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 views/main/password.html diff --git a/controllers/main.go b/controllers/main.go index ebf674a..7b083cd 100644 --- a/controllers/main.go +++ b/controllers/main.go @@ -16,6 +16,7 @@ import ( "strconv" "strings" "time" + "fmt" ) type MainController struct { @@ -117,29 +118,21 @@ func (this *MainController) Profile() { user, _ := models.UserGetById(this.userId) if this.isPost() { - flash := beego.NewFlash() user.Email = this.GetString("email") user.Update() password1 := this.GetString("password1") password2 := this.GetString("password2") if password1 != "" { if len(password1) < 6 { - flash.Error("密码长度必须大于6位") - flash.Store(&this.Controller) - this.redirect(beego.URLFor(".Profile")) + this.ajaxMsg("密码长度必须大于6位", MSG_ERR) } else if password2 != password1 { - flash.Error("两次输入的密码不一致") - flash.Store(&this.Controller) - this.redirect(beego.URLFor(".Profile")) + this.ajaxMsg("两次输入的密码不一致", MSG_ERR) } else { user.Salt = string(utils.RandomCreateBytes(10)) user.Password = libs.Md5([]byte(password1 + user.Salt)) user.Update() } } - // flash.Success("修改成功!") - // flash.Store(&this.Controller) - // this.redirect(beego.URLFor(".Profile")) this.ajaxMsg("", MSG_OK) } diff --git a/views/main/index.html b/views/main/index.html index e7f0115..6c60140 100644 --- a/views/main/index.html +++ b/views/main/index.html @@ -90,7 +90,9 @@ {{range $k, $v := .recentLogs}}
{{$v.start_time}}
diff --git a/views/main/password.html b/views/main/password.html deleted file mode 100644 index eb9bacf..0000000 --- a/views/main/password.html +++ /dev/null @@ -1 +0,0 @@ -密码修改 \ No newline at end of file diff --git a/views/main/profile.html b/views/main/profile.html index c53afaf..35ac3b3 100644 --- a/views/main/profile.html +++ b/views/main/profile.html @@ -40,9 +40,9 @@
- +
- +
不修改密码请留空 @@ -50,7 +50,7 @@
- +
@@ -73,8 +73,8 @@