Skip to content

Commit

Permalink
remove permissioned logic
Browse files Browse the repository at this point in the history
  • Loading branch information
medied committed Aug 28, 2018
1 parent b289ef1 commit 9fbaba3
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions imports/startup/both/modules/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,13 @@ import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';

import { Files } from '/imports/api/files/Files';
import { emailDomainCheck, emailListCheck } from '/lib/permissioned';

const _validateEmail = (email) => {
const val = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

let validDomain = true;
let validList = true;
let validEmail = true;
let valid = false;

// TODO verify if email already exists in db

if (Meteor.settings.public.app.config.permissioned.active) {
// check if valid emailDomain
if (Meteor.settings.public.app.config.permissioned.checkDomain) {
validDomain = emailDomainCheck(email);
}
// check if email in emailList
if (Meteor.settings.public.app.config.permissioned.checkList) {
validList = emailListCheck(email);
}
}
// check email format
validEmail = val.test(email);

valid = validDomain && validList && validEmail ? true : false;
valid = val.test(email);

Session.set("invalidEmail", !valid);
return valid;
Expand Down

0 comments on commit 9fbaba3

Please sign in to comment.