You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
524 B
25 lines
524 B
package http |
|
|
|
import ( |
|
"net/http" |
|
|
|
"go-common/library/ecode" |
|
bm "go-common/library/net/http/blademaster" |
|
) |
|
|
|
// check username and dashboard sessionid |
|
func checkCookie(c *bm.Context) (username, sid string, err error) { |
|
var r = c.Request |
|
var name *http.Cookie |
|
if name, err = r.Cookie("username"); err == nil { |
|
username = name.Value |
|
} |
|
var session *http.Cookie |
|
if session, err = r.Cookie("_AJSESSIONID"); err == nil { |
|
sid = session.Value |
|
} |
|
if username == "" || sid == "" { |
|
err = ecode.Unauthorized |
|
} |
|
return |
|
}
|
|
|