From caaeea617d1f1f61a5ad1500bab4fc4e46754a1b Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 22 Sep 2013 11:40:20 +0200 Subject: Fixed account activation --- activate.go | 16 ++++++++-------- mails.go | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/activate.go b/activate.go index cdc37a2..a3177ab 100644 --- a/activate.go +++ b/activate.go @@ -17,44 +17,44 @@ func activate(user model.User, sess *sessions.Session, req *http.Request) (inter if (_userid == "") || (code == "") { outdata.Msg = "User or code invalid. Check, if the activation link was correctly copied from the mail." - return outdata, user + return outdata, nil } userid, err := db.ParseDBID(_userid) if err != nil { outdata.Msg = "User or code invalid. Check, if the activation link was correctly copied from the mail." - return outdata, user + return outdata, nil } switch user, err = dbcon.UserByID(userid); err { case nil: case model.NotFound: outdata.Msg = "User not found." - return outdata, user + return outdata, nil default: log.Printf("Error while getting user by ID <%s>: %s", userid, err) outdata.Msg = "An unknown error occurred while loading user data." - return outdata, user + return outdata, nil } if user.ActivationCode() != code { outdata.Msg = "Wrong activation code." - return outdata, user + return outdata, nil } if err := user.SetActivationCode(""); err != nil { log.Printf("Error while resetting activation code: %s", err) outdata.Msg = "An unknown error occurred while activating the user." - return outdata, user + return outdata, nil } if err := user.SetActive(true); err != nil { log.Printf("Error while resetting activation code: %s", err) outdata.Msg = "An unknown error occurred while activating the user." - return outdata, user + return outdata, nil } outdata.Class = "success" outdata.Msg = "Account activated!" - return outdata, user + return outdata, nil } diff --git a/mails.go b/mails.go index d43245e..5fe663d 100644 --- a/mails.go +++ b/mails.go @@ -44,7 +44,7 @@ func SendActivationcode(to, acCode string, uid model.DBID) bool { fmt.Fprintln(buf, "") - url := fmt.Sprintf("%s/activate/U=%s&Code=%s", baseurl, uid, acCode) + url := fmt.Sprintf("%s/activate?U=%s&Code=%s", baseurl, uid, acCode) if err := mailActivationcode.Execute(buf, activationcodeData{url}); err != nil { log.Printf("Error while executing mail template (activationcode): %s", err) return false -- cgit v1.2.3-70-g09d2