diff --git a/routers/user/user.go b/routers/user/user.go index 7cd8bca5504..cf1314086c4 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -32,6 +32,14 @@ func SignIn(req *http.Request, r render.Render) { } // todo sign in + _, err := models.LoginUserPlain(req.FormValue("account"), req.FormValue("passwd")) + if err != nil { + r.HTML(200, "base/error", map[string]interface{}{ + "Error": fmt.Sprintf("%v", err), + }) + return + } + r.Redirect("/") } func SignUp(req *http.Request, r render.Render) { @@ -61,9 +69,16 @@ func SignUp(req *http.Request, r render.Render) { } err = models.RegisterUser(u) - r.HTML(403, "status/403", map[string]interface{}{ - "Title": fmt.Sprintf("%v", err), - }) + if err != nil { + if err != nil { + r.HTML(200, "base/error", map[string]interface{}{ + "Error": fmt.Sprintf("%v", err), + }) + return + } + } + + r.Redirect("/") } func Delete(req *http.Request, r render.Render) { diff --git a/templates/base/error.tmpl b/templates/base/error.tmpl new file mode 100644 index 00000000000..8d3c36be9a7 --- /dev/null +++ b/templates/base/error.tmpl @@ -0,0 +1,6 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +