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.task_name}} # {{$v.id}} + + {{$v.task_name}} # {{$v.id}} +
{{$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 @@