GitLab steht aufgrund wichtiger Wartungsarbeiten am Montag, den 8. März, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 573c1c0a authored by Daniel Gerhardt's avatar Daniel Gerhardt

Prevent group names of length < 5 when updating settings

This restriction does not apply to admins.
parent 2d9f8354
...@@ -16,7 +16,7 @@ class GroupsController < Groups::ApplicationController ...@@ -16,7 +16,7 @@ class GroupsController < Groups::ApplicationController
before_action :group_projects, only: [:show, :projects, :activity, :issues, :merge_requests] before_action :group_projects, only: [:show, :projects, :activity, :issues, :merge_requests]
before_action :event_filter, only: [:activity] before_action :event_filter, only: [:activity]
before_filter :validate_name, only: :create before_filter :validate_name, only: [:create, :update]
layout :determine_layout layout :determine_layout
...@@ -143,10 +143,15 @@ def load_events ...@@ -143,10 +143,15 @@ def load_events
end end
def validate_name def validate_name
@group = Group.new(group_params) group = Group.new(group_params)
unless @group.path.empty? || @group.path.length > 4 || current_user.is_admin? unless group.path.empty? || group.path.length > 4 || current_user.is_admin?
flash.now[:alert] = 'Path must have at least a length of 5.' flash.now[:alert] = 'Path must have at least a length of 5.'
render action: "new" if action_name == 'update'
render action: 'edit'
else
@group = group
render action: 'new'
end
end end
end end
end end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment