Heroku/Auth0 Rules - Whitespace - .edu -


i creating application using auth0 , heroku, create whitespace rule allows .edu addresses able login. however, whitespace skeleton shows specific addresses.

function (user, context, callback) {     //we care nameoftheappwithwhitelist     //bypass rule every other app     if(context.clientname !== 'nameoftheappwithwhitelist'){       return callback(null, user, context);     }  var whitelist = [ 'user1@mail.com', 'user2@mail.com' ]; //authorized users var userhasaccess = whitelist.some(   function (email) {     return email === user.email;   });  if (!userhasaccess) {   return callback(new unauthorizederror('access denied.')); }  callback(null, user, context); }   

any advice on how figure out how solve problem? im new javascript.

this works email addresses country-specific tlds, such .edu.ar:

var userhasaccess = email.split('@')[1].split('.').slice(-3, -1).indexof('edu') !== -1; 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -