File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 6
6
"goAdmin/connections/mysql"
7
7
"strconv"
8
8
"time"
9
+ "goAdmin/config"
9
10
)
10
11
11
12
func Check (password []byte , username string ) (user User , ok bool ) {
@@ -53,7 +54,7 @@ func SetCookie(ctx *fasthttp.RequestCtx, user User) bool {
53
54
var c fasthttp.Cookie
54
55
c .SetKey ("go_admin_session" )
55
56
c .SetValue (sessionKey )
56
- c .SetDomain ("localhost" )
57
+ c .SetDomain (config . EnvConfig [ "AUTH_DOMAIN" ].( string ) )
57
58
c .SetExpire (time .Now ().Add (time .Hour * 48 ))
58
59
ctx .Response .Header .SetCookie (& c )
59
60
@@ -64,7 +65,7 @@ func DelCookie(ctx *fasthttp.RequestCtx) bool {
64
65
var c fasthttp.Cookie
65
66
c .SetKey ("go_admin_session" )
66
67
c .SetValue ("" )
67
- c .SetDomain ("localhost" )
68
+ c .SetDomain (config . EnvConfig [ "AUTH_DOMAIN" ].( string ) )
68
69
c .SetExpire (time .Now ())
69
70
ctx .Response .Header .SetCookie (& c )
70
71
Original file line number Diff line number Diff line change @@ -18,4 +18,6 @@ var EnvConfig = map[string]interface{}{
18
18
"REDIS_DB" : 1 ,
19
19
20
20
"PORTABLE" : false ,
21
+
22
+ "AUTH_DOMAIN" : "localhost" ,
21
23
}
You can’t perform that action at this time.
0 commit comments