diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-09-15 13:58:39 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-09-15 13:58:39 +0200 |
commit | 3fa06b548e6808f286020c484a268beaf83ed781 (patch) | |
tree | f4c669a9fcb7349468388a032cafeb13addde087 | |
parent | 8800e05585c0f280064b5fff125084e831d3848b (diff) | |
download | mailremind-3fa06b548e6808f286020c484a268beaf83ed781.tar.gz mailremind-3fa06b548e6808f286020c484a268beaf83ed781.tar.bz2 mailremind-3fa06b548e6808f286020c484a268beaf83ed781.zip |
Better error messages.
-rw-r--r-- | activate.go | 6 | ||||
-rw-r--r-- | checkjobs.go | 2 | ||||
-rw-r--r-- | deleteacc.go | 2 | ||||
-rw-r--r-- | login.go | 4 | ||||
-rw-r--r-- | pwreset.go | 14 | ||||
-rw-r--r-- | register.go | 8 | ||||
-rw-r--r-- | settings.go | 2 |
7 files changed, 19 insertions, 19 deletions
diff --git a/activate.go b/activate.go index 59e7eed..74e2d76 100644 --- a/activate.go +++ b/activate.go @@ -33,7 +33,7 @@ func activate(user model.User, sess *sessions.Session, req *http.Request) (inter return outdata, user default: log.Printf("Error while getting user by ID <%s>: %s", userid, err) - outdata.Msg = "An error occurred while loading user data. Send a message to the support, if this happens again." + outdata.Msg = "An unknown error occurred while loading user data." return outdata, user } @@ -44,13 +44,13 @@ func activate(user model.User, sess *sessions.Session, req *http.Request) (inter if err := user.SetActivationCode(""); err != nil { log.Printf("Error while resetting activation code: %s", err) - outdata.Msg = "An error occurred while activating the user. Send a message to the support, if this happens again." + outdata.Msg = "An unknown error occurred while activating the user." return outdata, user } if err := user.SetActive(true); err != nil { log.Printf("Error while resetting activation code: %s", err) - outdata.Msg = "An error occurred while activating the user. Send a message to the support, if this happens again." + outdata.Msg = "An unknown error occurred while activating the user." return outdata, user } diff --git a/checkjobs.go b/checkjobs.go index 3974c9b..1bd94b2 100644 --- a/checkjobs.go +++ b/checkjobs.go @@ -49,7 +49,7 @@ func checkjobsOnce(t time.Time) { } } else { if err := job.SetNext(next); err != nil { - log.Printf("Filed setting next for job %s: %s", job.ID(), err) + log.Printf("Failed setting next for job %s: %s", job.ID(), err) } } } diff --git a/deleteacc.go b/deleteacc.go index 826cc1b..24c90fe 100644 --- a/deleteacc.go +++ b/deleteacc.go @@ -27,7 +27,7 @@ func deleteacc(user model.User, sess *sessions.Session, req *http.Request) (inte if err := user.Delete(); err != nil { log.Printf("Error while deleting account: %s", err) outdata.Class = "error" - outdata.Msg = "An error occurred during deletion. Please contact support, if this happens again." + outdata.Msg = "An error occurred during deletion." return outdata, user } @@ -29,7 +29,7 @@ func login(user model.User, sess *sessions.Session, req *http.Request) (interfac } if err := req.ParseForm(); err != nil { - outdata.Error = "Data of form could not be understand. If this happens again, please contact support!" + outdata.Error = "Formdata corrupted. Please try again." return outdata, user } @@ -47,7 +47,7 @@ func login(user model.User, sess *sessions.Session, req *http.Request) (interfac return outdata, user default: log.Printf("Error while loding user data (login): %s", err) - outdata.Error = "User data could not be loaded. Please contact support, if this happens again." + outdata.Error = "User data could not be loaded." return outdata, user } @@ -14,7 +14,7 @@ type pwresetTpldata struct { func pwreset(user model.User, sess *sessions.Session, req *http.Request) (interface{}, model.User) { if err := req.ParseForm(); err != nil { - return &pwresetTpldata{Error: "Could not understand formdata."}, user + return &pwresetTpldata{Error: "Form data corrupted."}, user } code := req.FormValue("Code") @@ -58,13 +58,13 @@ func pwreset(user model.User, sess *sessions.Session, req *http.Request) (interf hash, err := bcrypt.GenerateFromPassword([]byte(pw1), bcrypt.DefaultCost) if err != nil { log.Printf("Could not has password: %s", err) - outdata.Error = "Failed hashing you password. If this happens again, please contact support." + outdata.Error = "Could not save password." return outdata, user } if err := user.SetPWHash(hash); err != nil { - log.Printf("Error while storing new password: %s", err) - outdata.Error = "Could not store password. If this happens again, please contact support." + log.Printf("Error while hashing password: %s", err) + outdata.Error = "Could not save password." return outdata, user } @@ -86,7 +86,7 @@ func forgotpw(user model.User, sess *sessions.Session, req *http.Request) (inter } if err := req.ParseForm(); err != nil { - return &forgotpwTpldata{Error: "Could not understand formdata."}, user + return &forgotpwTpldata{Error: "Form data corrupted."}, user } email := req.FormValue("Mail") @@ -102,11 +102,11 @@ func forgotpw(user model.User, sess *sessions.Session, req *http.Request) (inter key := genAcCode() if err := user.SetActivationCode(key); err != nil { log.Printf("Could not store pwreset key: %s", err) - return &forgotpwTpldata{Error: "Could not store keyword reset code. If this happens again, please contact support."}, user + return &forgotpwTpldata{Error: "Could not generate a keyword reset code."}, user } if !SendPwresetLink(user.Email(), key, user.ID()) { - return &forgotpwTpldata{Error: "Could not send reset E-Mail. If this happens again, please contact support."}, user + return &forgotpwTpldata{Error: "Could not send reset E-Mail."}, user } return &forgotpwTpldata{Success: "We sent you an E-Mail with further instructions."}, user diff --git a/register.go b/register.go index 5bd4d82..9c8e7c1 100644 --- a/register.go +++ b/register.go @@ -47,7 +47,7 @@ func register(user model.User, sess *sessions.Session, req *http.Request) (inter } if err := req.ParseForm(); err != nil { - outdata.Error = "Data of form could not be understand. If this happens again, please contact support!" + outdata.Error = "Form data corrupted." return outdata, user } @@ -76,7 +76,7 @@ func register(user model.User, sess *sessions.Session, req *http.Request) (inter case model.NotFound: default: log.Printf("Error while checking, if mail is used: %s", err) - outdata.Error = "Internal error, sorry. If this happens again, please contact support!" + outdata.Error = "Internal error, sorry." return outdata, user } @@ -84,14 +84,14 @@ func register(user model.User, sess *sessions.Session, req *http.Request) (inter pwhash, err := bcrypt.GenerateFromPassword([]byte(indata.Password), bcrypt.DefaultCost) if err != nil { log.Printf("Error while hashing password: %s", err) - outdata.Error = "Internal error, sorry. If this happens again, please contact support!" + outdata.Error = "Internal error, sorry." return outdata, user } user, err = dbcon.AddUser(mail, pwhash, indata.Timezone.Loc, false, acCode) if err != nil { log.Printf("Could not create user (%s): %s", indata.Mail, err) - outdata.Error = "Internal error, sorry. If this happens again, please contact support!" + outdata.Error = "Internal error, sorry." return outdata, user } diff --git a/settings.go b/settings.go index a10b901..4bde9dc 100644 --- a/settings.go +++ b/settings.go @@ -50,7 +50,7 @@ func settings(user model.User, sess *sessions.Session, req *http.Request) (inter hash, err := bcrypt.GenerateFromPassword([]byte(req.FormValue("Password")), bcrypt.DefaultCost) if err != nil { log.Printf("Error hashing password: %s", err) - outdata.Error = "Error while hashing password data." + outdata.Error = "Error while saving password." return outdata.Error, user } |