質問編集履歴
1
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,7 +44,23 @@
|
|
44
44
|
|
45
45
|
}
|
46
46
|
|
47
|
+
|
48
|
+
|
49
|
+
sess, _ := session.Get("session", c)
|
50
|
+
|
51
|
+
sess.Options = &sessions.Options{
|
52
|
+
|
53
|
+
Path: "/",
|
54
|
+
|
55
|
+
MaxAge: 86400 * 7,
|
56
|
+
|
57
|
+
HttpOnly: true,
|
58
|
+
|
59
|
+
}
|
60
|
+
|
47
|
-
sess
|
61
|
+
sess.Values["user"] = user // ここでUserの構造体を設定したい
|
62
|
+
|
63
|
+
sess.Save(c.Request(), c.Response())
|
48
64
|
|
49
65
|
// 略
|
50
66
|
|
@@ -54,7 +70,9 @@
|
|
54
70
|
|
55
71
|
func GetUser(c echo.Context) error {
|
56
72
|
|
73
|
+
sess, _ := session.Get("session", c)
|
74
|
+
|
57
|
-
user := sess
|
75
|
+
user := sess.Values["user"]
|
58
76
|
|
59
77
|
fmt.Println(user) // nilになる
|
60
78
|
|