29 lines
534 B
Go
Raw Normal View History

2017-06-16 23:32:47 +00:00
package auth
2017-06-11 09:13:59 +00:00
import "github.com/aerogo/aero"
2017-06-22 20:26:52 +00:00
import "github.com/animenotifier/notify.moe/utils"
2017-06-11 09:13:59 +00:00
2017-06-16 23:32:47 +00:00
// Install ...
func Install(app *aero.Application) {
2017-06-15 17:56:09 +00:00
// Google
2017-06-16 23:32:47 +00:00
InstallGoogleAuth(app)
2017-06-11 09:13:59 +00:00
2017-07-02 21:42:46 +00:00
// Facebook
InstallFacebookAuth(app)
2017-06-15 19:59:14 +00:00
// Logout
app.Get("/logout", func(ctx *aero.Context) string {
2017-06-17 20:19:26 +00:00
if ctx.HasSession() {
2017-06-22 20:26:52 +00:00
user := utils.GetUser(ctx)
if user != nil {
authLog.Info("User logged out", user.ID, ctx.RealIP(), user.Email, user.RealName())
}
2017-06-17 20:19:26 +00:00
ctx.Session().Set("userId", nil)
}
2017-06-15 19:59:14 +00:00
return ctx.Redirect("/")
})
2017-06-11 09:13:59 +00:00
}