mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-07-15 00:00:57 -05:00
Added email resending endpoint
This commit is contained in:
parent
f701647747
commit
48aabe0bfc
|
|
@ -2,6 +2,7 @@ const router = require('express').Router();
|
|||
const dns = require('dns');
|
||||
const xmlbuilder = require('xmlbuilder');
|
||||
const moment = require('moment');
|
||||
const util = require('../../../util');
|
||||
const database = require('../../../database');
|
||||
|
||||
/**
|
||||
|
|
@ -86,4 +87,31 @@ router.put('/email_confirmation/:pid/:code', async (request, response) => {
|
|||
response.status(200).send('');
|
||||
});
|
||||
|
||||
/**
|
||||
* [GET]
|
||||
* Replacement for: https://account.nintendo.net/v1/api/support/resend_confirmation
|
||||
* Description: Resends a users confirmation email
|
||||
*/
|
||||
router.get('/resend_confirmation', async (request, response) => {
|
||||
const pid = request.headers['x-nintendo-pid'];
|
||||
|
||||
const pnid = await database.getUserByPID(pid);
|
||||
|
||||
if (!pnid) {
|
||||
// TODO - Unsure if this is the right error
|
||||
return response.status(400).send(xmlbuilder.create({
|
||||
errors: {
|
||||
error: {
|
||||
code: '0130',
|
||||
message: 'PID has not been registered yet'
|
||||
}
|
||||
}
|
||||
}).end());
|
||||
}
|
||||
|
||||
await util.sendConfirmationEmail(pnid);
|
||||
|
||||
response.status(200).send('');
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Loading…
Reference in New Issue
Block a user