mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix the validation again
This commit is contained in:
parent
4e46043aae
commit
933c354926
1 changed files with 6 additions and 3 deletions
|
@ -74,9 +74,12 @@ class Site < Sequel::Model
|
||||||
|
|
||||||
# Check for existing user
|
# Check for existing user
|
||||||
|
|
||||||
user = self.class.select(:username).filter(username: values[:username]).first
|
user = self.class.select(:id, :username).filter(username: values[:username]).first
|
||||||
if !user.nil? || (!new? && user.id != values[:id])
|
|
||||||
errors.add :username, 'This username is already taken. Try using another one.'
|
if user
|
||||||
|
if user.id != values[:id]
|
||||||
|
errors.add :username, 'This username is already taken. Try using another one.'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if values[:password].nil? || (@password_length && @password_length < MINIMUM_PASSWORD_LENGTH)
|
if values[:password].nil? || (@password_length && @password_length < MINIMUM_PASSWORD_LENGTH)
|
||||||
|
|
Loading…
Add table
Reference in a new issue