aboutsummaryrefslogtreecommitdiff
path: root/routers/user/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/user.go')
-rw-r--r--routers/user/user.go34
1 files changed, 28 insertions, 6 deletions
diff --git a/routers/user/user.go b/routers/user/user.go
index 8d8691a3..ad84ff6c 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -157,13 +157,23 @@ func Delete(ctx *middleware.Context) {
return
}
- if err := models.DeleteUser(ctx.User); err != nil {
+ rawPasswd := ctx.Query("password")
+ encodedPwd, _ := models.EncodePasswd(rawPasswd)
+ if len(encodedPwd) == 0 || encodedPwd != ctx.User.Passwd {
ctx.Data["HasError"] = true
- switch err.Error() {
- case models.ErrUserOwnRepos.Error():
- ctx.Data["ErrorMsg"] = "Your account still have ownership of repository, you have to delete or transfer them first."
- default:
- ctx.Handle(200, "user.Delete", err)
+ ctx.Data["ErrorMsg"] = "Your password error. Make sure you are owner of this account."
+ } else {
+ if err := models.DeleteUser(ctx.User); err != nil {
+ ctx.Data["HasError"] = true
+ switch err {
+ case models.ErrUserOwnRepos:
+ ctx.Data["ErrorMsg"] = "Your account still have ownership of repository, you have to delete or transfer them first."
+ default:
+ ctx.Handle(200, "user.Delete", err)
+ return
+ }
+ } else {
+ ctx.Render.Redirect("/")
return
}
}
@@ -189,3 +199,15 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) {
}
ctx.Render.JSON(200, &feeds)
}
+
+func Issues(ctx *middleware.Context) string {
+ return "This is issues page"
+}
+
+func Pulls(ctx *middleware.Context) string {
+ return "This is pulls page"
+}
+
+func Stars(ctx *middleware.Context) string {
+ return "This is stars page"
+}