|
|
@ -34,7 +34,7 @@ func Dashboard(ctx *middleware.Context) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
ctx.Data["Feeds"] = feeds |
|
|
|
ctx.Data["Feeds"] = feeds |
|
|
|
ctx.HTML(200, "user/dashboard", ctx.Data) |
|
|
|
ctx.HTML(200, "user/dashboard") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Profile(ctx *middleware.Context, params martini.Params) { |
|
|
|
func Profile(ctx *middleware.Context, params martini.Params) { |
|
|
@ -70,19 +70,19 @@ func Profile(ctx *middleware.Context, params martini.Params) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["PageIsUserProfile"] = true |
|
|
|
ctx.Data["PageIsUserProfile"] = true |
|
|
|
ctx.HTML(200, "user/profile", ctx.Data) |
|
|
|
ctx.HTML(200, "user/profile") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func SignIn(ctx *middleware.Context, form auth.LogInForm) { |
|
|
|
func SignIn(ctx *middleware.Context, form auth.LogInForm) { |
|
|
|
ctx.Data["Title"] = "Log In" |
|
|
|
ctx.Data["Title"] = "Log In" |
|
|
|
|
|
|
|
|
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
ctx.HTML(200, "user/signin", ctx.Data) |
|
|
|
ctx.HTML(200, "user/signin") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) { |
|
|
|
if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) { |
|
|
|
ctx.HTML(200, "user/signin", ctx.Data) |
|
|
|
ctx.HTML(200, "user/signin") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -113,7 +113,7 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) { |
|
|
|
ctx.Data["PageIsSignUp"] = true |
|
|
|
ctx.Data["PageIsSignUp"] = true |
|
|
|
|
|
|
|
|
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
ctx.HTML(200, "user/signup", ctx.Data) |
|
|
|
ctx.HTML(200, "user/signup") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -126,7 +126,7 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ctx.HasError() { |
|
|
|
if ctx.HasError() { |
|
|
|
ctx.HTML(200, "user/signup", ctx.Data) |
|
|
|
ctx.HTML(200, "user/signup") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -153,12 +153,12 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) { |
|
|
|
log.Trace("%s User created: %s", ctx.Req.RequestURI, strings.ToLower(form.UserName)) |
|
|
|
log.Trace("%s User created: %s", ctx.Req.RequestURI, strings.ToLower(form.UserName)) |
|
|
|
|
|
|
|
|
|
|
|
// Send confirmation e-mail.
|
|
|
|
// Send confirmation e-mail.
|
|
|
|
if base.Service.RegisterEmailConfirm { |
|
|
|
if base.Service.RegisterEmailConfirm && u.Id > 1 { |
|
|
|
mailer.SendRegisterMail(ctx.Render, u) |
|
|
|
mailer.SendRegisterMail(ctx.Render, u) |
|
|
|
ctx.Data["IsSendRegisterMail"] = true |
|
|
|
ctx.Data["IsSendRegisterMail"] = true |
|
|
|
ctx.Data["Email"] = u.Email |
|
|
|
ctx.Data["Email"] = u.Email |
|
|
|
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60 |
|
|
|
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60 |
|
|
|
ctx.Render.HTML(200, "user/active", ctx.Data) |
|
|
|
ctx.HTML(200, "user/active") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
ctx.Redirect("/user/login") |
|
|
|
ctx.Redirect("/user/login") |
|
|
@ -170,7 +170,7 @@ func Delete(ctx *middleware.Context) { |
|
|
|
ctx.Data["IsUserPageSettingDelete"] = true |
|
|
|
ctx.Data["IsUserPageSettingDelete"] = true |
|
|
|
|
|
|
|
|
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
if ctx.Req.Method == "GET" { |
|
|
|
ctx.HTML(200, "user/delete", ctx.Data) |
|
|
|
ctx.HTML(200, "user/delete") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -195,7 +195,7 @@ func Delete(ctx *middleware.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.HTML(200, "user/delete", ctx.Data) |
|
|
|
ctx.HTML(200, "user/delete") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
@ -218,21 +218,25 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Issues(ctx *middleware.Context) { |
|
|
|
func Issues(ctx *middleware.Context) { |
|
|
|
ctx.HTML(200, "user/issues", ctx.Data) |
|
|
|
ctx.HTML(200, "user/issues") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Pulls(ctx *middleware.Context) { |
|
|
|
func Pulls(ctx *middleware.Context) { |
|
|
|
ctx.HTML(200, "user/pulls", ctx.Data) |
|
|
|
ctx.HTML(200, "user/pulls") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Stars(ctx *middleware.Context) { |
|
|
|
func Stars(ctx *middleware.Context) { |
|
|
|
ctx.HTML(200, "user/stars", ctx.Data) |
|
|
|
ctx.HTML(200, "user/stars") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Activate(ctx *middleware.Context) { |
|
|
|
func Activate(ctx *middleware.Context) { |
|
|
|
code := ctx.Query("code") |
|
|
|
code := ctx.Query("code") |
|
|
|
if len(code) == 0 { |
|
|
|
if len(code) == 0 { |
|
|
|
ctx.Data["IsActivatePage"] = true |
|
|
|
ctx.Data["IsActivatePage"] = true |
|
|
|
|
|
|
|
if ctx.User.IsActive { |
|
|
|
|
|
|
|
ctx.Error(404) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
// Resend confirmation e-mail.
|
|
|
|
// Resend confirmation e-mail.
|
|
|
|
if base.Service.RegisterEmailConfirm { |
|
|
|
if base.Service.RegisterEmailConfirm { |
|
|
|
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60 |
|
|
|
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60 |
|
|
@ -240,7 +244,7 @@ func Activate(ctx *middleware.Context) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ctx.Data["ServiceNotEnabled"] = true |
|
|
|
ctx.Data["ServiceNotEnabled"] = true |
|
|
|
} |
|
|
|
} |
|
|
|
ctx.Render.HTML(200, "user/active", ctx.Data) |
|
|
|
ctx.HTML(200, "user/active") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -259,5 +263,5 @@ func Activate(ctx *middleware.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["IsActivateFailed"] = true |
|
|
|
ctx.Data["IsActivateFailed"] = true |
|
|
|
ctx.Render.HTML(200, "user/active", ctx.Data) |
|
|
|
ctx.HTML(200, "user/active") |
|
|
|
} |
|
|
|
} |
|
|
|