@@ -2,8 +2,8 @@ import dns from 'node:dns';
2
2
import express from 'express' ;
3
3
import xmlbuilder from 'xmlbuilder' ;
4
4
import moment from 'moment' ;
5
- import { getPNIDByPID } from '@/database' ;
6
- import { sendEmailConfirmedEmail , sendConfirmationEmail , sendForgotPasswordEmail } from '@/util' ;
5
+ import { getPNIDByEmailAddress , getPNIDByPID } from '@/database' ;
6
+ import { sendEmailConfirmedEmail , sendConfirmationEmail , sendForgotPasswordEmail , sendEmailConfirmedParentalControlsEmail } from '@/util' ;
7
7
8
8
const router = express . Router ( ) ;
9
9
@@ -125,6 +125,35 @@ router.get('/resend_confirmation', async (request: express.Request, response: ex
125
125
response . status ( 200 ) . send ( '' ) ;
126
126
} ) ;
127
127
128
+ /**
129
+ * [GET]
130
+ * Replacement for: https://account.nintendo.net/v1/api/support/send_confirmation/pin/:email
131
+ * Description: Sends a users confirmation email that their email has been registered for parental controls
132
+ */
133
+ router . get ( '/send_confirmation/pin/:email' , async ( request : express . Request , response : express . Response ) : Promise < void > => {
134
+ const email = request . params . email ;
135
+
136
+ const pnid = await getPNIDByEmailAddress ( email ) ;
137
+
138
+ if ( ! pnid ) {
139
+ // TODO - Unsure if this is the right error
140
+ response . status ( 400 ) . send ( xmlbuilder . create ( {
141
+ errors : {
142
+ error : {
143
+ code : '0130' ,
144
+ message : 'PID has not been registered yet'
145
+ }
146
+ }
147
+ } ) . end ( ) ) ;
148
+
149
+ return ;
150
+ }
151
+
152
+ await sendEmailConfirmedParentalControlsEmail ( pnid ) ;
153
+
154
+ response . status ( 200 ) . send ( '' ) ;
155
+ } ) ;
156
+
128
157
/**
129
158
* [GET]
130
159
* Replacement for: https://account.nintendo.net/v1/api/support/forgotten_password/PID
@@ -156,4 +185,4 @@ router.get('/forgotten_password/:pid', async (request: express.Request, response
156
185
response . status ( 200 ) . send ( '' ) ;
157
186
} ) ;
158
187
159
- export default router ;
188
+ export default router ;
0 commit comments