You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
547 B

package pages
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/markbates/goth/gothic"
"net/http"
"sponsorahacker/auth"
)
func Home(c *gin.Context) {
user, err := gothic.GetFromSession("user", c.Request)
if err != nil {
fmt.Println("error checking login", err)
}
auth.HydrateUser(user)
if err != nil {
fmt.Println("error checking login", err)
c.HTML(http.StatusOK, "index.html", gin.H{
"title": "Sponsor a Hacker",
"isLoggedIn": false,
})
return
}
c.Redirect(http.StatusTemporaryRedirect, "/welcome")
}