cleaning err print statement
This commit is contained in:
@@ -163,7 +163,6 @@ func RemoveVolunteerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
teamLeadID, err := strconv.Atoi(r.FormValue("team_lead_id"))
|
teamLeadID, err := strconv.Atoi(r.FormValue("team_lead_id"))
|
||||||
fmt.Print(teamLeadID)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, "Invalid team lead ID", http.StatusBadRequest)
|
http.Error(w, "Invalid team lead ID", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -57,7 +56,6 @@ func Render(w http.ResponseWriter, tmpl string, data interface{}) {
|
|||||||
|
|
||||||
// Get individual components from environment variables
|
// Get individual components from environment variables
|
||||||
TemplatesURL := os.Getenv("TEMPLATES_URL")
|
TemplatesURL := os.Getenv("TEMPLATES_URL")
|
||||||
fmt.Print(TemplatesURL)
|
|
||||||
|
|
||||||
// Paths for layout + page templates
|
// Paths for layout + page templates
|
||||||
layout := filepath.Join(TemplatesURL, "layout.html")
|
layout := filepath.Join(TemplatesURL, "layout.html")
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ func authMiddleware(next http.HandlerFunc) http.HandlerFunc {
|
|||||||
func adminMiddleware(next http.HandlerFunc) http.HandlerFunc {
|
func adminMiddleware(next http.HandlerFunc) http.HandlerFunc {
|
||||||
return authMiddleware(func(w http.ResponseWriter, r *http.Request) {
|
return authMiddleware(func(w http.ResponseWriter, r *http.Request) {
|
||||||
role, ok := r.Context().Value("user_role").(int)
|
role, ok := r.Context().Value("user_role").(int)
|
||||||
fmt.Print(role)
|
|
||||||
if !ok || role != 1 {
|
if !ok || role != 1 {
|
||||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
@@ -124,7 +123,6 @@ func adminMiddleware(next http.HandlerFunc) http.HandlerFunc {
|
|||||||
func volunteerMiddleware(next http.HandlerFunc) http.HandlerFunc {
|
func volunteerMiddleware(next http.HandlerFunc) http.HandlerFunc {
|
||||||
return authMiddleware(func(w http.ResponseWriter, r *http.Request) {
|
return authMiddleware(func(w http.ResponseWriter, r *http.Request) {
|
||||||
role, ok := r.Context().Value("user_role").(int)
|
role, ok := r.Context().Value("user_role").(int)
|
||||||
fmt.Print(role)
|
|
||||||
if !ok || (role != 3 && role != 2) {
|
if !ok || (role != 3 && role != 2) {
|
||||||
fmt.Printf("Access denied: role %d not allowed\n", role) // Debug log
|
fmt.Printf("Access denied: role %d not allowed\n", role) // Debug log
|
||||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
|
|||||||
BIN
app/tmp/main
BIN
app/tmp/main
Binary file not shown.
Reference in New Issue
Block a user