summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-09-22 11:40:20 +0200
committerKevin Chabowski <kevin@kch42.de>2013-09-22 11:40:20 +0200
commitcaaeea617d1f1f61a5ad1500bab4fc4e46754a1b (patch)
treef6e1be40afbf016752f345f5321266e7b7b8de8c
parent583ed86142b797c667dc68251a4594ea56d47a1b (diff)
downloadmailremind-caaeea617d1f1f61a5ad1500bab4fc4e46754a1b.tar.gz
mailremind-caaeea617d1f1f61a5ad1500bab4fc4e46754a1b.tar.bz2
mailremind-caaeea617d1f1f61a5ad1500bab4fc4e46754a1b.zip
Fixed account activation
-rw-r--r--activate.go16
-rw-r--r--mails.go2
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