parent
9407c7a94d
commit
f3f967f9f7
@ -18,6 +18,8 @@ class User < ApplicationRecord
|
||||
validates_format_of :cn, without: /\A-/,
|
||||
if: Proc.new{ |u| u.cn.present? },
|
||||
message: "is invalid. Usernames need to start with a letter."
|
||||
validates_format_of :cn, without: /\A(#{Setting.reserved_usernames.join('|')})\z/i,
|
||||
message: "has already been taken"
|
||||
|
||||
validates_uniqueness_of :email
|
||||
validates :email, email: true
|
||||
|
@ -109,5 +109,11 @@ RSpec.describe "Signup", type: :feature do
|
||||
expect(page).to have_content("confirm your address")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Reserved usernames" do
|
||||
fill_in "user_cn", with: "accounts"
|
||||
click_button "Continue"
|
||||
expect(page).to have_content("Username has already been taken")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user