diff --git a/EduSync.exe b/EduSync.exe index c5e6f76..35d309a 100644 Binary files a/EduSync.exe and b/EduSync.exe differ diff --git a/auth.go b/authHandler.go similarity index 82% rename from auth.go rename to authHandler.go index 9586320..0bad972 100644 --- a/auth.go +++ b/authHandler.go @@ -47,16 +47,7 @@ func AuthHandler(router *mux.Router, config *Config) { }).Methods("GET") router.HandleFunc("/login", func(res http.ResponseWriter, req *http.Request) { - t, err := template.ParseFiles("templates/index.html") - if err != nil { - http.Error(res, err.Error(), http.StatusInternalServerError) - return - } - t.Execute(res, false) - }).Methods("GET") - - router.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) { - t, err := template.ParseFiles("templates/home.html") + t, err := template.ParseFiles("templates/login.html") if err != nil { http.Error(res, err.Error(), http.StatusInternalServerError) return diff --git a/main.go b/main.go index 7fa92be..af2183f 100644 --- a/main.go +++ b/main.go @@ -19,12 +19,14 @@ func main() { } router := mux.NewRouter() + + // Serving static files fs := http.FileServer(http.Dir("assets")) router.PathPrefix("/assets").Handler(http.StripPrefix("/assets", fs)) - //http.Handle("/resources/", http.StripPrefix("/resources", fs)) // Set up authentication routes AuthHandler(router, config) + RoleHandler(router) log.Println("listening on localhost:8080") err = http.ListenAndServeTLS(":8080", "cert.pem", "key.pem", router) diff --git a/roleHandler.go b/roleHandler.go new file mode 100644 index 0000000..65c4902 --- /dev/null +++ b/roleHandler.go @@ -0,0 +1,46 @@ +package main + +import ( + "html/template" + "net/http" + + "github.com/gorilla/mux" +) + +func RoleHandler(router *mux.Router) { + router.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) { + t, err := template.ParseFiles("templates/index.html") + if err != nil { + http.Error(res, err.Error(), http.StatusInternalServerError) + return + } + t.Execute(res, false) + }).Methods("GET") + + router.HandleFunc("/admin", func(res http.ResponseWriter, req *http.Request) { + t, err := template.ParseFiles("templates/admin/index.html") + if err != nil { + http.Error(res, err.Error(), http.StatusInternalServerError) + return + } + t.Execute(res, nil) + }).Methods("GET") + + router.HandleFunc("/student", func(res http.ResponseWriter, req *http.Request) { + t, err := template.ParseFiles("templates/student/index.html") + if err != nil { + http.Error(res, err.Error(), http.StatusInternalServerError) + return + } + t.Execute(res, nil) + }).Methods("GET") + + router.HandleFunc("/instructor", func(res http.ResponseWriter, req *http.Request) { + t, err := template.ParseFiles("templates/instructor/index.html") + if err != nil { + http.Error(res, err.Error(), http.StatusInternalServerError) + return + } + t.Execute(res, nil) + }).Methods("GET") +} diff --git a/templates/admin/index.html b/templates/admin/index.html new file mode 100644 index 0000000..88a59fc --- /dev/null +++ b/templates/admin/index.html @@ -0,0 +1,170 @@ + + + + EduSync + + + + + + + + +
+ + + + + +
+
+

Need assistance? Contact us at nkedusync@gmail.com

+
+
+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 6dfeff9..52b1052 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,20 +1,147 @@ - + - Google SignIn - - - + EduSync + + + + + + -
-
-

Social Authentication

-

Login or Register with:

- SignIn with Google -
-
+
+ + + + +
+
+

Any Queries? Ask us a question at nkedusync@gmail.com

+
+
+ + +
+ + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/templates/instructor/index.html b/templates/instructor/index.html new file mode 100644 index 0000000..eb4c0a9 --- /dev/null +++ b/templates/instructor/index.html @@ -0,0 +1,171 @@ + + + + EduSync + + + + + + + + +
+ + + + + +
+
+

Have questions? Contact us at nkedusync@gmail.com

+
+
+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..6dfeff9 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,20 @@ + + + + Google SignIn + + + + + +
+
+

Social Authentication

+

Login or Register with:

+ SignIn with Google +
+
+ + \ No newline at end of file diff --git a/templates/home.html b/templates/student/index.html similarity index 71% rename from templates/home.html rename to templates/student/index.html index cbee5e1..862c098 100644 --- a/templates/home.html +++ b/templates/student/index.html @@ -44,7 +44,27 @@ +
-

Any Queries? Ask us a question at nkedusync@gmail.com

+

Have questions? Contact us at nkedusync@gmail.com

+ -