Skip to content

Commit

Permalink
Simplify and fix ADMIN_EMAIL verification regex. Fixes RocketChat#2841
Browse files Browse the repository at this point in the history
 * Email addresses start with something other than "@", have arbitrary characters,
   at least one "@", at least one character after that.
  • Loading branch information
henryk committed Apr 14, 2016
1 parent b8c6e20 commit c98c6ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/startup/initialData.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Meteor.startup ->
console.log "Name: #{adminUser.name}".green

if process.env.ADMIN_EMAIL?
re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
re = /^[^@].*@[^@]+$/i
if re.test process.env.ADMIN_EMAIL
if not RocketChat.models.Users.findOneByEmailAddress process.env.ADMIN_EMAIL
adminUser.emails = [
Expand Down

0 comments on commit c98c6ea

Please sign in to comment.