aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorPeter <peter@smitmail.eu>2014-12-17 17:41:49 +0200
committerPeter <peter@smitmail.eu>2014-12-17 17:41:49 +0200
commitec71d538fcb1f84050048a660a25258a5401828f (patch)
treed3155912217eefba56a60dd80d8a7c6fa59e30cc /routers
parent6919c80f0bdaffbf4f39c42a12536daae7f4fe79 (diff)
downloadgitea-ec71d538fcb1f84050048a660a25258a5401828f.tar.gz
gitea-ec71d538fcb1f84050048a660a25258a5401828f.zip
Method for activating email addresses through verification email
Diffstat (limited to 'routers')
-rw-r--r--routers/user/auth.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index c695f929a7..a5b27453ec 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -343,6 +343,27 @@ func Activate(ctx *middleware.Context) {
ctx.HTML(200, ACTIVATE)
}
+func ActivateEmail(ctx *middleware.Context) {
+ code := ctx.Query("code")
+ email_string := ctx.Query("email")
+
+ // Verify code.
+ if email := models.VerifyActiveEmailCode(code, email_string); email != nil {
+ err := email.Activate()
+ if err != nil {
+ ctx.Handle(500, "ActivateEmail", err)
+ }
+
+ log.Trace("Email activated: %s", email.Email)
+
+ ctx.Flash.Success(ctx.Tr("settings.activate_email_success"))
+
+ }
+
+ ctx.Redirect(setting.AppSubUrl + "/user/settings/email")
+ return
+}
+
func ForgotPasswd(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("auth.forgot_password")