Commit 08a9ac11 authored by Boiget Boiget's avatar Boiget Boiget

Add missing files

parent 598c3d42
Pipeline #2332 passed with stages
in 5 minutes and 16 seconds
import { Meteor } from 'meteor/meteor';
import logServer from './logging';
// checks if the domain part of an email address matches whitelisted domains
export default function checkDomain(email) {
let res = false;
const domainMail = email.split('@')[1];
const whiteDomains = Meteor.settings.private.whiteDomains || [];
whiteDomains.forEach((whiteDomain) => {
if (new RegExp(whiteDomain).test(domainMail)) {
logServer(` Email domain matches ${whiteDomain}: user activated`);
res = true;
}
});
return res;
}
import { Meteor } from 'meteor/meteor';
import i18n from 'meteor/universe:i18n';
import { createNotification } from './notifications/methods';
const levels = ['info', 'warning', 'error'];
function logServer(message, level = 'info', userNotify = null) {
if (!levels.includes(level)) throw new Meteor.Error('api.logging.logServer', i18n.__('api.logging.unknownLogLevel'));
console.log(message);
if (userNotify) {
const user = Meteor.users.findOne(userNotify);
if (user) {
const notifData = {
userId: userNotify,
title: i18n.__(`api.logging.${level}`),
content: message,
type: level,
};
createNotification._execute({}, { data: notifData });
}
}
}
export default logServer;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment