Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sqEmail: {
- key: 'swWFOuzWxsGUu5401ezNYSJOpRhn9xWC3TiSnSOVkuPOATOB8op6h9VH0d4aK1MO',
- token: 'b9ZsM31aGPvYCj9EMuw02QAK95dcCraNAagndixT73SKm2p9wV9yMKjVQw7sXify'
- }
- .then(({ user, token }) => {
- const body = {
- doc: 'ju73s4h47eni',
- email: user.email,
- language: 'en',
- data: {
- RECOVER_PASSWORD: `https://roadtrip.finalfantasyxv.com/reset?resetModal=true&resetToken=${token}`,
- USERNAME: [user.name.first, user.name.last].join(' ')
- }
- };
- const bodyHash = crypto.createHmac('sha1', env.sqEmail.key)
- .update(`POST\n/api/v1/send/\n${JSON.stringify(body)}`).digest('hex');
- console.log(bodyHash);
- return rp.post({
- uri: 'https://xmail.square-enix.com/api/v1/send',
- headers: {
- 'Cache-Control': 'no-cache',
- 'Content-Type': 'application/x-json-list',
- 'Auth-Hmac': bodyHash,
- 'Auth-Token': env.sqEmail.token
- },
- body: JSON.stringify(body)
- });
- })
- .then(() => res.json({ status: 'OK' }))
- .catch(error => res.status(400).json({ error }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement