summaryrefslogtreecommitdiffstats
path: root/routers/repo/setting.go
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2018-08-07 11:01:06 +0100
committerLauris BH <lauris@nix.lv>2018-08-07 13:01:06 +0300
commit59b10e66f757441e8c74532f30740bf4a96e9ac1 (patch)
treec303efa6ce5bc98bfcec6a912fe181c72f6f0ead /routers/repo/setting.go
parentc7a6ee5c0bd8dcceac76dcb2100e81395d57560a (diff)
downloadgitea-59b10e66f757441e8c74532f30740bf4a96e9ac1.tar.gz
gitea-59b10e66f757441e8c74532f30740bf4a96e9ac1.zip
An inactive user shouldn't be able to be added as a collaborator (#4535)
* an inactive user shouldn't be able to be a collaborator * use translated error message * add active user check when adding a new collaborator via the api * fix translation text * added collaborator test * improvee testcases
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r--routers/repo/setting.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 835ba0a751..b1f50d5387 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -381,6 +381,12 @@ func CollaborationPost(ctx *context.Context) {
return
}
+ if !u.IsActive {
+ ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator_inactive_user"))
+ ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
+ return
+ }
+
// Organization is not allowed to be added as a collaborator.
if u.IsOrganization() {
ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))