Display a message if not in the current promo
This commit is contained in:
parent
f0d5296a31
commit
b7029b643e
2 changed files with 26 additions and 7 deletions
7
auth.go
7
auth.go
|
@ -26,11 +26,16 @@ func init() {
|
|||
router.POST("/api/auth/logout", apiRawHandler(logout))
|
||||
}
|
||||
|
||||
type authToken struct {
|
||||
*User
|
||||
CurrentPromo uint `json:"current_promo"`
|
||||
}
|
||||
|
||||
func validateAuthToken(u *User, _ httprouter.Params, _ []byte) HTTPResponse {
|
||||
if u == nil {
|
||||
return APIErrorResponse{status: http.StatusUnauthorized, err: fmt.Errorf("Not connected")}
|
||||
} else {
|
||||
return APIResponse{u}
|
||||
return APIResponse{authToken{u, currentPromo}}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue