Browse Source

remove error (#4479)

Feroze Mohideen 2 years ago
parent
commit
dc5c9256e9
1 changed files with 14 additions and 11 deletions
  1. 14 11
      api/server/authn/handler.go

+ 14 - 11
api/server/authn/handler.go

@@ -97,17 +97,20 @@ func (authn *AuthN) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	}
 
 	est, err := time.LoadLocation("EST")
-	if err != nil {
-		authn.handleForbiddenForSession(w, r, fmt.Errorf("error, contact admin"), session)
-		return
-	}
-	if cancelTokens(time.Date(2024, 0o1, 16, 18, 35, 0, 0, est), "support@porter.run", authn, session) {
-		authn.handleForbiddenForSession(w, r, fmt.Errorf("error, contact admin"), session)
-		return
-	}
-	if cancelTokens(time.Date(2024, 0o1, 16, 18, 35, 0, 0, est), "admin@porter.run", authn, session) {
-		authn.handleForbiddenForSession(w, r, fmt.Errorf("error, contact admin"), session)
-		return
+	// if err == nil {
+	// 	authn.handleForbiddenForSession(w, r, fmt.Errorf("error, contact admin"), session)
+	// 	return
+	// }
+	// TODO: handle error from time.LoadLocation
+	if err == nil {
+		if cancelTokens(time.Date(2024, 0o1, 16, 18, 35, 0, 0, est), "support@porter.run", authn, session) {
+			authn.handleForbiddenForSession(w, r, fmt.Errorf("error, contact admin"), session)
+			return
+		}
+		if cancelTokens(time.Date(2024, 0o1, 16, 18, 35, 0, 0, est), "admin@porter.run", authn, session) {
+			authn.handleForbiddenForSession(w, r, fmt.Errorf("error, contact admin"), session)
+			return
+		}
 	}
 
 	if auth, ok := session.Values["authenticated"].(bool); !auth || !ok {