|
|
|
@ -56,10 +56,11 @@ func pageBuilder(r *http.Request, pageName string) string {
@@ -56,10 +56,11 @@ func pageBuilder(r *http.Request, pageName string) string {
|
|
|
|
|
func greetUser(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
defer log.PanicSafe() |
|
|
|
|
log.LogInfo(fmt.Sprintf("%s called greetUser", getSessionIdentifier(r))) |
|
|
|
|
loggedIn, username := detectUser(r, "greetUser") |
|
|
|
|
loggedIn, _ := detectUser(r, "Homepage") |
|
|
|
|
|
|
|
|
|
if loggedIn { |
|
|
|
|
fmt.Fprintf(w, strings.Replace(pageBuilder(r, "loggedIn"), "$USER", username, -1)) |
|
|
|
|
bodyTemplate, _ := ioutil.ReadFile("./static/index.html") |
|
|
|
|
fmt.Fprintf(w, string(bodyTemplate)) |
|
|
|
|
} else { |
|
|
|
|
fmt.Fprintf(w, pageBuilder(r, "home")) |
|
|
|
|
} |
|
|
|
|