2017-06-11 09:13:59 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "github.com/aerogo/aero"
|
|
|
|
|
2017-06-15 17:56:09 +00:00
|
|
|
// EnableLogin ...
|
|
|
|
func EnableLogin(app *aero.Application) {
|
|
|
|
// Google
|
2017-06-11 09:13:59 +00:00
|
|
|
EnableGoogleLogin(app)
|
|
|
|
|
|
|
|
// Session middleware
|
|
|
|
app.Use(func(ctx *aero.Context, next func()) {
|
|
|
|
// Handle the request first
|
|
|
|
next()
|
|
|
|
|
|
|
|
// Update session if it has been modified
|
|
|
|
if ctx.HasSession() && ctx.Session().Modified() {
|
|
|
|
app.Sessions.Store.Set(ctx.Session().ID(), ctx.Session())
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|