Skip to content

Commit ad39c50

Browse files
committed
prevent git operations for inactive users
1 parent 4117a44 commit ad39c50

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

routers/private/serv.go

+6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ func ServNoCommand(ctx *macaron.Context) {
6161
})
6262
return
6363
}
64+
if !user.IsActive {
65+
ctx.JSON(http.StatusForbidden, map[string]interface{}{
66+
"err": fmt.Sprintf("Your account is unactived."),
67+
})
68+
return
69+
}
6470
results.Owner = user
6571
}
6672
ctx.JSON(http.StatusOK, &results)

routers/repo/http.go

+5
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ func HTTP(ctx *context.Context) {
244244
}
245245
}
246246

247+
if !authUser.IsActive {
248+
ctx.HandleText(http.StatusForbidden, "Your account is unactived.")
249+
return
250+
}
251+
247252
if repoExist {
248253
perm, err := models.GetUserRepoPermission(repo, authUser)
249254
if err != nil {

0 commit comments

Comments
 (0)