passport.use( new BasicStrategy(async (email, password, cb) => { const user = (await db.query('SELECT * FROM account WHERE email=$1', [ email ])).rows[0] if (!user) return cb(null, false) if (!user.activated) return cb(null, false) const passwordValid = await bcrypt.compare(password, user.password) if (!passwordValid) return cb(null, false) let token = jwt.sign( { // jwt claims go here // this includes standard claims like iat (issued at) // as well as any custom data you would like to include email: email }, process.env.JWT_SECRET ) return cb(null, token) }) )
var batchWriteRow = function () { var params = { tables: [{ tableName: tableName, rows: [], }], }; for (var i = 0; i < 10; i++) { params.tables[0].rows.push({ type: 'UPDATE', condition: new TableStore.Condition(TableStore.RowExistenceExpectation.IGNORE, null), primaryKey: primaryKey, attributeColumns: [{ "PUT": [{ 'multiVersionCol': '第' + i + '次更新', 'timestamp': Long.fromNumber(new Date().getTime() + i) }] }] }); } client.batchWriteRow(params, function (err, data) { if (err) { console.log('error:', err); return; } getRow(); }); }
app.post(`/api/resendactivationemail`, async (req, res) => { try { const { email } = req.body const activationCode = (await db.query( 'SELECT * FROM account WHERE email=$1', [email] )).rows[0].activation_code const activationLink = getActivationLink(activationCode, env) await sendMail({ from: 'foo@example.com', // sender address to: email, // list of receivers (string, comma separated) subject: 'Account created', // Subject line text: stripIndents` Congratulations, your account has been successfully created! To activate your account, please click the link below or paste into your web browser. ${activationLink} ` // plain text body // html: "<b>Hello world?</b>" // html body }) return res .status(200) .json({ message: 'Your account activation email has been resent.' }) } catch (error) { return res.status(400).json({ error: error }) } })
alpha: 0, }); if (kernel.columns % 2 === 0 || kernel.rows % 2 === 0) { throw new TypeError( 'open: The number of rows and columns of the kernel must be odd',
alpha: 0, }); if (kernel.columns % 2 === 0 || kernel.rows % 2 === 0) { throw new TypeError( 'dilate: The number of rows and columns of the kernel must be odd',
alpha: 0, }); if (kernel.columns % 2 === 0 || kernel.rows % 2 === 0) { throw new TypeError( 'morphologicalGradient: The number of rows and columns of the kernel must be odd',
alpha: 0, }); if (kernel.columns % 2 === 0 || kernel.rows % 2 === 0) { throw new TypeError( 'blackHat: The number of rows and columns of the kernel must be odd',
alpha: 0, }); if (kernel.columns % 2 === 0 || kernel.rows % 2 === 0) { throw new TypeError( 'erode: The number of rows and columns of the kernel must be odd',
passport.use( new BasicStrategy(async (email, password, cb) => { const user = (await db.query('SELECT * FROM account WHERE email=$1', [ email ])).rows[0] if (!user) return cb(null, false) if (!user.activated) return cb(null, false) const passwordValid = await bcrypt.compare(password, user.password) if (!passwordValid) return cb(null, false) let token = jwt.sign( { // jwt claims go here // this includes standard claims like iat (issued at) // as well as any custom data you would like to include email: email }, process.env.JWT_SECRET ) return cb(null, token) }) )
app.post(`/api/resendactivationemail`, async (req, res) => { try { const { email } = req.body const activationCode = (await db.query( 'SELECT * FROM account WHERE email=$1', [email] )).rows[0].activation_code const activationLink = getActivationLink(activationCode, env) await sendMail({ from: 'foo@example.com', // sender address to: email, // list of receivers (string, comma separated) subject: 'Account created', // Subject line text: stripIndents` Congratulations, your account has been successfully created! To activate your account, please click the link below or paste into your web browser. ${activationLink} ` // plain text body // html: "<b>Hello world?</b>" // html body }) return res .status(200) .json({ message: 'Your account activation email has been resent.' }) } catch (error) { return res.status(400).json({ error: error }) } })
alpha: 0, }); if (kernel.columns % 2 === 0 || kernel.rows % 2 === 0) { throw new TypeError( 'close: The number of rows and columns of the kernel must be odd',