Make forbidden screen names configurable

This commit is contained in:
Karina Kwiatek 2022-07-22 23:44:42 +02:00 committed by Karina Kwiatek
parent fc161e2dcf
commit 5f60d86efe
2 changed files with 18 additions and 4 deletions

View File

@ -1,10 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class ScreenNameValidator < ActiveModel::EachValidator class ScreenNameValidator < ActiveModel::EachValidator
FORBIDDEN_SCREEN_NAMES = %w[justask_admin retrospring_admin admin justask retrospring about public FORBIDDEN_SCREEN_NAMES = APP_CONFIG["forbidden_screen_names"].freeze
notifications inbox sign_in sign_up sidekiq moderation moderator mod administrator
siteadmin site_admin help retro_spring retroospring retrosprlng niisding nllsding
pixeidesu plxeldesu plxeidesu terms privacy linkfilter feedback].freeze
FORBIDDEN_SCREEN_NAME_REGEXPS = [/wreciap\z/i].freeze FORBIDDEN_SCREEN_NAME_REGEXPS = [/wreciap\z/i].freeze
def validate_each(record, attribute, value) def validate_each(record, attribute, value)

View File

@ -9,6 +9,23 @@ email_from: "noreply@justask.rrerr.net"
# Name of the "Anonymous" user. (e.g. "Anonymous Coward", "Arno Nym", "Mr. X", ...) # Name of the "Anonymous" user. (e.g. "Anonymous Coward", "Arno Nym", "Mr. X", ...)
anonymous_name: "Anonymous" anonymous_name: "Anonymous"
forbidden_screen_names:
- justask_admin
- retrospring_admin
- admin
- justask
- retrospring
- moderation
- moderator
- mod
- administrator
- siteadmin
- site_admin
- help
- retro_spring
- retroospring
- retrosprlng
# Text shown on the about page (Markdown can be used here) # Text shown on the about page (Markdown can be used here)
about: | about: |
# About # About