mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
no hyphens at start or end of username
This commit is contained in:
parent
afb1d756e0
commit
837b0ea2d0
1 changed files with 2 additions and 2 deletions
|
@ -658,7 +658,7 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
def self.valid_username?(username)
|
||||
!username.empty? && username.match(/^[a-zA-Z0-9_\-]+$/i)
|
||||
!username.empty? && username.match(/^[a-zA-Z0-9][a-zA-Z0-9_\-]+[a-zA-Z0-9]$/i)
|
||||
end
|
||||
|
||||
def self.disposable_email_domains
|
||||
|
@ -986,7 +986,7 @@ class Site < Sequel::Model
|
|||
super
|
||||
|
||||
if !self.class.valid_username?(values[:username])
|
||||
errors.add :username, 'Usernames can only contain letters, numbers, and hyphens.'
|
||||
errors.add :username, 'Usernames can only contain letters, numbers, and hyphens, and cannot start or end with a hyphen.'
|
||||
end
|
||||
|
||||
if !values[:username].blank?
|
||||
|
|
Loading…
Add table
Reference in a new issue