Allow existing user records with reserved usernames to be saved
Some checks are pending
continuous-integration/drone/push Build is running

This commit is contained in:
Râu Cao 2023-11-01 22:26:53 +01:00
parent be5fe00f20
commit 03a1d9f277
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -38,7 +38,8 @@ class User < ApplicationRecord
message: "is invalid. Usernames need to start with a letter."
# FIXME This needs a server restart to apply values
validates_format_of :cn, without: /\A(#{Setting.reserved_usernames.join('|')})\z/i,
message: "has already been taken"
message: "has already been taken",
unless: Proc.new{ |u| u.persisted? }
validates_uniqueness_of :email
validates :email, email: true