Simplify and fix ADMIN_EMAIL verification regex. Fixes RocketChat/Rocket.Chat#2841 (#2890)

* Email addresses start with something other than "@", have arbitrary characters,
   at least one "@", at least one character after that.
pull/2908/head
henryk 10 years ago committed by Gabriel Engel
parent 0b75c41429
commit 1767003cd6
  1. 2
      server/startup/initialData.coffee

@ -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 = [

Loading…
Cancel
Save