forked from cbonello/revel-csrf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
34 lines (28 loc) · 723 Bytes
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package controllers
import (
"github.com/revel/revel"
"github.com/cbonello/revel-csrf/samples/demo/app/routes"
"fmt"
)
type App struct {
*revel.Controller
}
func (c App) Index() revel.Result {
return c.Render()
}
func (c App) Hello(name string) revel.Result {
route := c.Request.Request.URL.Path
exempted := (route == "/HelloExempted")
return c.Render(name, exempted)
}
func (c App) Hello123Exempted(name string) revel.Result {
return c.Render(name)
}
func (c App) Logout(name string) revel.Result {
fmt.Printf("Deleting session keys...\n")
for k := range c.Session {
fmt.Printf("Deleting Session[%s]: '%s'\n", k, c.Session[k])
delete(c.Session, k)
}
return c.Redirect(routes.App.Index())
}