Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function generateUserEmailValidationCode(userId, clientId, transaction) {
// Create unique validation code for userId
const code = uniqid();
// Store validation code in table
await models().emailVerificationCode.create(
{
verificationCode: code,
activated: false,
userId: userId,
clientId: clientId,
gracePeriod: 2
},
{ transaction: transaction }
);
return code;
}
if (!type) {
return respondWithError(`File "type" missing.`);
}
const contentType = mime.lookup(name);
if (!contentType) {
return respondWithError(`File's content type could not be resolved.`);
}
if (contentType !== type) {
return respondWithError(`Detected and received file types don't match.`);
}
let key = sanitizeFilename(name);
if (key) {
key = uniqueId() + "_" + key;
}
// Replace all whitespace.
key = key.replace(/\s/g, "");
return respond({
code: "FILE_UPLOAD_SUCCESS",
data: {
file: {
name: key,
src: "/files/" + key,
type: contentType,
size
},
s3: {
url: "/files/upload",
app.get('/join', nocache, async function(req, res) {
// if already signed in, skip
if(req.session.user)
res.redirect(req.query.r || '/')
req.session.joinCode = req.session.joinCode || uniqid()
res.render('join', {
user: req.session.user,
title: 'Join',
code: req.session.joinCode,
fail: req.session.joinFailWhy,
already: req.session.join || {},
project: signupProjectId != null,
csrfToken: req.csrfToken()
})
delete req.session.joinFailWhy
})
import SectionShapes from './section-shapes'
import SectionDrawing from './section-drawing'
import SectionBicycling from './section-bicycling'
import SectionTransit from './section-transit'
import SectionGround from './section-ground'
import SectionOptions from './section-options'
import SectionOverlayView from './section-overlay-view'
import SectionSearchbox from './section-searchbox'
import styles from './styles.module.css'
const Loading = <div>
const googleMapsLibraries = ['drawing', 'visualization', 'places']
const loaderId = uniqid('loader-')
const onLoad = () => console.log('script loaded')
const onError = err => console.log('onError: ', err)
const GoogleMaps = ({ googleMapsApiKey, language }) => (
</div>
const uniqId = (props, dispatch) => {
if (props.token) {
console.log("using params: ", props.token)
dispatch(props.action, props.token)
} else {
console.log("generating uniqid")
const p = process("#")
window.location = window.location + p
dispatch(props.action, p)
}
}
...translationSearchMatches.reduce((acc, match) => {
if (!match) return acc;
const id = match.id || uuid();
acc[id] = {
...match,
id,
translationType: "AA Search Match",
isOrf: true, //pass isOrf = true here in order to not have it show up in the properties window
forward: !match.bottomStrand
};
return acc;
}, {}),
...reduce(
entities = Object.values( tests ).reduce( ( carry, test ) => {
if ( position.before && position.before === test.id ) {
const gid = id || uniqid();
carry[ gid ] = { ...testDefaultState( gid ), ...options, commands: {}};
}
carry[ test.id ] = test;
if ( position.after && position.after === test.id ) {
const gid = id || uniqid();
carry[ gid ] = { ...testDefaultState( gid ), ...options, commands: {}};
}
return carry;
}, {});
constructor(props) {
super(props);
const { text1, text2, open } = this.props;
this.texts = [];
this.state = {
scales: [0, 0],
gaps: [0, 0],
open,
close: !open,
texts: [text1, text2]
};
this.id = uniqid();
this.size = this.props.size;
this.forceClose = this.props.forceClose || false;
this.center = this.size / 2;
this.strokeWidth = 2;
this.offset = 7.5;
this.dasharray = 20;
this.isFirefox = typeof InstallTrigger !== "undefined";
}
const entities = Object.values( targets ).reduce( ( carry, target ) => {
if ( position.before && position.before === target.id ) {
const gid = id || uniqid();
carry[ gid ] = { ...targetDefaultState( gid ), ...options };
}
carry[ target.id ] = target;
if ( position.after && position.after === target.id ) {
const gid = id || uniqid();
carry[ gid ] = { ...targetDefaultState( gid ), ...options };
}
return carry;
}, {});
.then((errorJSON) => {
dispatch('addAlert', {
id: uniqueId('alert_'),
type: 'danger',
message: errorJSON.message
})
})
})