Bug #1613

Email address format validation preventing admin user creation

Added by Andy Shinn over 7 years ago. Updated about 7 years ago.

DB migrations
Target version:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:


On both RPM versions 0.4.2-0.1 and 0.5.1-1 the admin user is being created with the Auth type not set. On 0.4.2, without the :login setting, I can browse to the dashboard which logs me in as admin. If I then enable :login and refresh the dashboard I am automatically logged in and can see that the admin user has no Auth type set.

When I try to reset the admin user I receive the following Mail is invalid error

[root@foreman1 foreman]# rake -t -v permissions:reset RAILS_ENV=production 
Libvirt binding are missing - hypervisor management is disabled
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/lib/ruby/gems/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
** Invoke permissions:reset (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute permissions:reset
Mail is invalid

I am able to bypass the error by commenting out the validation in the user model:

# validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true

This happens both with a domain of localdomain or The latter appears to pass with email address . I am not sure what may be failing.

This is on CentOS 6 x86_64 using foreman-installer.

Associated revisions

Revision 111a4083 (diff)
Added by Ohad Levy about 7 years ago

fixes #1613 - Email address format validation preventing admin user creation


#1 Updated by Ohad Levy over 7 years ago

  • Difficulty set to easy

#2 Updated by Ohad Levy about 7 years ago

  • Target version deleted (1.0)

Hi Andy,

I've tried to reproduce, but none of my test email addresses were failing, can you mention which email address did it try to create it under?


#3 Updated by Andy Shinn about 7 years ago

I was trying with a local domain I had setup. The local domain is called, literally, 'localdomain'. So my root email is . I'm in the process of setting up a new environment to test Foreman in so if this is reproducible it can be closed and I can reopen if it happens on the latest version.

#4 Updated by Ohad Levy about 7 years ago

  • Assignee set to Ohad Levy
  • Priority changed from Low to Normal
  • Target version set to 1.0

#5 Updated by Ohad Levy about 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF