summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-03 22:44:51 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-03 22:44:51 +0800
commitb73cf0ee77cf035b118315568c605f4f54fa81aa (patch)
treef533974faf938d48f99106f58c12c46532bf462e /routers
parentc2dbaebde047b1593edee964121d15255dfba66f (diff)
parentaad4856948eeba50fdaedab34ca6346423aad158 (diff)
downloadgitea-b73cf0ee77cf035b118315568c605f4f54fa81aa.tar.gz
gitea-b73cf0ee77cf035b118315568c605f4f54fa81aa.zip
merge
Diffstat (limited to 'routers')
-rw-r--r--routers/user/user.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/routers/user/user.go b/routers/user/user.go
index cf1314086c..d2da19d5a0 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -9,6 +9,7 @@ import (
"net/http"
"github.com/martini-contrib/render"
+ "github.com/martini-contrib/sessions"
"github.com/gogits/validation"
@@ -23,7 +24,7 @@ func Profile(r render.Render) {
return
}
-func SignIn(req *http.Request, r render.Render) {
+func SignIn(req *http.Request, r render.Render, session sessions.Session) {
if req.Method == "GET" {
r.HTML(200, "user/signin", map[string]interface{}{
"Title": "Log In",
@@ -31,14 +32,16 @@ func SignIn(req *http.Request, r render.Render) {
return
}
- // todo sign in
- _, err := models.LoginUserPlain(req.FormValue("account"), req.FormValue("passwd"))
+ // TODO: LDAP sign in
+ user, 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
}
+ session.Set("userId", user.Id)
+ session.Set("userName", user.Name)
r.Redirect("/")
}