Finish delete user

Unknown 10 years ago
parent b3de0ded70
commit 12f81de349

@ -1,7 +1,7 @@
Gogs - Go Git Service [![Go Walker](](
Gogs - Go Git Service [![wercker status]( "wercker status")]( [![Go Walker](](
Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language.
Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language, it currently supports Linux and Max OS X, but Windows has **NOT** supported yet due to installation problem with [libgit2]( in Windows.
## Purpose
@ -9,14 +9,14 @@ There are some very good products in this category such as [gitlab](http://gitla
## Overview
Please see [Wiki]( for project design.
Please see [Wiki]( for project design, develop specification, change log and road map.
## Installation
### Dependencies
There are two ways to install Gogs:
- [Go Programming Language]( Main develop language.
- [libgit2]( Git data manipulation.
- [Install from binary](
- [Install from source](
## Acknowledgments

@ -20,7 +20,7 @@ import (
// Test that go1.1 tag above is included in builds. main.go refers to this definition.
const go11tag = true
const APP_VER = ""
const APP_VER = ""
func init() {

@ -150,10 +150,10 @@ func UpdateUser(user *User) (err error) {
// DeleteUser completely deletes everything of the user.
func DeleteUser(user *User) error {
cnt, err := GetRepositoryCount(user)
count, err := GetRepositoryCount(user)
if err != nil {
return errors.New("modesl.GetRepositories: " + err.Error())
} else if cnt > 0 {
} else if count > 0 {
return ErrUserOwnRepos

@ -151,8 +151,18 @@ func Delete(data base.TmplData, req *http.Request, session sessions.Session, r r
id := auth.SignedInId(session)
u := &models.User{Id: id}
err := models.DeleteUser(u)
data["ErrorMsg"] = err
log.Error("user.Delete: %v", data)
r.HTML(200, "base/error", nil)
if err := models.DeleteUser(u); err != nil {
data["HasError"] = true
switch err.Error() {
case models.ErrUserOwnRepos.Error():
data["ErrorMsg"] = "Your account still have ownership of repository, you have to delete or transfer them first."
data["ErrorMsg"] = err
log.Error("user.Delete: %v", data)
r.HTML(200, "base/error", nil)
r.HTML(200, "user/delete", data)

@ -15,7 +15,7 @@
<div id="gogs-user-setting-container" class="col-md-9">
<form action="/user/delete" method="post" class="form-horizontal" id="gogs-user-delete">
<h4>Delete Account</h4>
<p class="alert alert-danger">Deleting your account is permanent. Sorry to see you go, if you have any feedback you can contact us.</p>
<p class="alert alert-danger">{{if not .HasError}}The operation will delete your account permanently. Sorry to see you go, but we know you'll back soon.{{else}}{{.ErrorMsg}}{{end}}</p>
<div class="form-group">
<div class="col-md-3">
<button type="submit" class="btn btn-danger btn-lg">Delete Account</button>

@ -0,0 +1 @@
box: wercker/default