summaryrefslogtreecommitdiff
path: root/signup.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2017-09-25 22:37:21 +0200
committerNikolaus Gotsche <n@softwarefools.com>2017-09-25 22:37:21 +0200
commit4a0b4a5c406e3b9da7d4f10d14ec87c3c173a4db (patch)
treecc127110d36b39783a72b945f0512f296e675ddf /signup.go
parent931fdd01358989f6ab73e29c949449e9639d005b (diff)
backend output
Diffstat (limited to 'signup.go')
-rw-r--r--signup.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/signup.go b/signup.go
index e659505..43d08fb 100644
--- a/signup.go
+++ b/signup.go
@@ -6,7 +6,7 @@ import _ "github.com/go-sql-driver/mysql"
import "golang.org/x/crypto/bcrypt"
import "net/http"
-
+import "fmt"
import "os/exec"
var db *sql.DB
@@ -41,9 +41,11 @@ func signupPage(res http.ResponseWriter, req *http.Request) {
_, err = db.Exec("INSERT INTO players(username, password, uuid) VALUES(?, ?, ?)", username, hashedPassword, newuuid)
if err != nil {
http.Error(res, "Server Error Inserting User. Unable to create account! You Fool...", 500)
+ fmt.Println("Error adding User",username)
return
}
res.Write([]byte("User Created Successfully!"))
+ fmt.Println("Successfully Created User",username,newuuid)
return
case err != nil:
http.Error(res, "Server Error! Something fucked up", 500)
@@ -70,16 +72,19 @@ func loginPage(res http.ResponseWriter, req *http.Request) {
if err != nil {
http.Redirect(res, req, "/login", 301)
+ fmt.Println("Failed Login atempt by",username)
return
}
err = bcrypt.CompareHashAndPassword([]byte(databasePassword), []byte(password))
if err != nil {
http.Redirect(res, req, "/login", 301)
+ fmt.Println(username," used wrong Password ",password)
return
}
res.Write([]byte("Hello "+ databaseUsername + "! Your UUID is "+ databaseUUID))
+ fmt.Println("Successful Login by",username)
}
func homePage(res http.ResponseWriter, req *http.Request) {