Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const currentUser = Meteor.users.findOne(this.userId);
const currentUserName = getCurrentUserName(currentUser);
// uses primaryShop's data (name, address etc) in email copy sent to new merchant
const dataForEmail = getDataForEmail({ shop: primaryShop, currentUserName, name, token, emailLogo });
Meteor.users.update(userId, {
$set: {
"services.password.reset": { token, email, when: new Date() },
name,
"profile.preferences.reaction.activeShopId": shopId
}
});
Reaction.Email.send({
to: email,
from: `${_.get(dataForEmail, "primaryShop.name")} <${_.get(dataForEmail, "primaryShop.emails[0].address")}>`,
subject: SSR.render(subject, dataForEmail),
html: SSR.render(tpl, dataForEmail)
});
return true;
}
function processEvents(req) {
var ipaddr = _.get(req.headers, "x-forwarded-for") || "127.0.0.1";
var geoip = utils.getGeoIP(ipaddr);
var geoinfo = geoip.code;
if(!geoinfo) {
geoinfo = geoip.ip;
if(geoinfo !== "127.0.0.1") {
// debug("Anomaly, unresolved IP different from localhost: %s", geoinfo);
geoinfo = "redacted";
}
}
var headers = processHeaders(_.get(req, 'headers'), {
'content-length': 'length',
'x-fbtrex-build': 'build',
'x-fbtrex-version': 'version',
'x-fbtrex-userid': 'supporterId',
.value();
for (let i = 0; i < words.length; ++i) {
const word = words[i];
// Gx, Mx
if (word.indexOf('G') === 0 || word.indexOf('M') === 0) {
const r = _.find(SMOOTHIE_MODAL_GROUPS, (group) => {
return _.includes(group.modes, word);
});
if (!r) {
continue;
}
const prevWord = _.get(payload, 'modal.' + r.group, '');
if (prevWord) {
_.set(payload, 'modal.' + r.group, ensureArray(prevWord).concat(word));
} else {
_.set(payload, 'modal.' + r.group, word);
}
continue;
}
// T: tool number
if (word.indexOf('T') === 0) {
_.set(payload, 'tool', word.substring(1));
continue;
}
// F: feed rate
connect: async (ctx, next) => {
const grantConfig = await strapi.store({
environment: '',
type: 'plugin',
name: 'users-permissions',
key: 'grant'
}).get();
const [ protocol, host ] = strapi.config.url.split('://');
_.defaultsDeep(grantConfig, { server: { protocol, host } });
const provider = process.platform === 'win32' ? ctx.request.url.split('\\')[2] : ctx.request.url.split('/')[2];
const config = grantConfig[provider];
if (!_.get(config, 'enabled')) {
return ctx.badRequest(null, 'This provider is disabled.');
}
const Grant = require('grant-koa');
const grant = new Grant(grantConfig);
return strapi.koaMiddlewares.compose(grant.middleware)(ctx, next);
},
this.schema.set(this.model, newValue);
changed = true;
} else if (this.schema.model) {
this.setModelValueByPath(this.schema.model, newValue);
changed = true;
}
if (changed) {
this.$emit("model-updated", newValue, this.schema.model);
if (isFunction(this.schema.onChanged)) {
this.schema.onChanged.call(this, this.model, newValue, oldValue, this.schema);
}
if (objGet(this.formOptions, "validateAfterChanged", false) === true) {
if (objGet(this.schema, "validateDebounceTime", objGet(this.formOptions, "validateDebounceTime", 0)) > 0) {
this.debouncedValidate();
} else {
this.validate();
}
}
}
},
export function getSelectedPage(state: State): string {
const pageIndex = getSelectedPageIndex(state);
const pages = getPages(state);
return get(pages, `[${pageIndex}].id`);
}
_.map(configArray, (config, ind) => {
if (_.get(config, checkPath) === _.get(configObj, checkPath)) {
hasConfig = true;
if (!_.isEqual(config, configObj)) {
hasConfig = false;
configArray.splice(ind, 1);
}
}
});
return hasConfig;
const dockName =
dock.api_state == -1
? this.props.t('main:Locked')
: dock.api_state == 0
? this.props.t('main:Empty')
: displayShipName
? this.props.t(
`resources:${$ships[ships[dock.api_ship_id].api_ship_id].api_name}`,
)
: ''
const completeTime = dock.api_complete_time || -1
let hpPercentage
if (dock.api_state > 0) {
hpPercentage =
(100 * get(ships, [dock.api_ship_id, 'api_nowhp'])) /
get(ships, [dock.api_ship_id, 'api_maxhp'])
}
return (
{enableAvatar && (
<>
{dock.api_state > 0 ? (
return inputs.map(element => {
const { name, required } = this.getFieldTypeDefinition(element.type);
return {
name: get(element, 'name.value'),
type: name,
hasQuestionToken: !required,
kind: StructureKind.Parameter,
};
});
}
getContexts() {
return _.get(this, 'result.contexts');
}