diff --git a/app/models/team.rb b/app/models/team.rb index 77ee1325d52..5e266a6af81 100755 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -261,7 +261,7 @@ def self.export(csv, parent_id, options, teamtype) if options[:team_name] == 'false' team_members = TeamsUser.where(team_id: team.id) team_members.each do |user| - user_export = user.respond_to?(:username) ? user.username : user.user + user_export = user.is_a?(User) ? user.username : user.user output.push(user_export) end end diff --git a/app/models/user.rb b/app/models/user.rb index e38248a9cb5..7465315cc10 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -20,7 +20,7 @@ class User < ApplicationRecord belongs_to :parent, class_name: 'User' belongs_to :role validates :username, presence: true - validates_uniqueness_of :username, :case_sensitive => true + validates_uniqueness_of :username validates :username, format: { without: /\s/ } validates :email, presence: { message: "can't be blank" }