Implemented Google login

This commit is contained in:
2017-06-07 21:12:59 +02:00
parent 3cc9ba54c6
commit c222a814e4
4 changed files with 62 additions and 10 deletions

View File

@ -1,7 +1,10 @@
package dashboard
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
const maxPosts = 5
@ -21,5 +24,17 @@ func Get(ctx *aero.Context) string {
// }
// return ctx.HTML(components.Dashboard(posts))
userID := ctx.Session().GetString("userId")
if userID != "" {
user, err := arn.GetUser(userID)
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching user data", err)
}
return ctx.HTML("Welcome back, " + user.Nick + "!")
}
return ctx.HTML("ARN 4.0 is currently under construction.<br><a href='https://paypal.me/blitzprog' target='_blank' rel='noopener'>Support the development</a><br><a href='/auth/google'>Login via Google</a>")
}