File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ module.exports = function (waw) {
25
25
auth : waw . config . mail . auth ,
26
26
} ) ;
27
27
28
- waw . send = ( opts , cb = ( resp ) => { } ) => {
28
+ waw . send = ( opts , cb = ( resp ) => { } ) => {
29
29
transporter . sendMail (
30
30
{
31
31
from : waw . config . mail . from ,
@@ -38,7 +38,7 @@ module.exports = function (waw) {
38
38
) ;
39
39
} ;
40
40
} else {
41
- waw . send = ( ) => { } ;
41
+ waw . send = ( ) => { } ;
42
42
}
43
43
44
44
const set_is = async ( email , is ) => {
@@ -142,7 +142,7 @@ module.exports = function (waw) {
142
142
] ,
143
143
} ) ;
144
144
} ;
145
- const new_pin = async ( user , cb = ( ) => { } ) => {
145
+ const new_pin = async ( user , cb = ( ) => { } ) => {
146
146
user . resetPin = Math . floor ( Math . random ( ) * ( 999999 - 100000 ) ) + 100000 ;
147
147
148
148
console . log ( user . resetPin ) ;
@@ -220,7 +220,12 @@ module.exports = function (waw) {
220
220
"/change" : async ( req , res ) => {
221
221
const user = await findUser ( req . body . email ) ;
222
222
223
- if ( user && user . resetPin === req . body . resetPin ) {
223
+ if (
224
+ user &&
225
+ user . resetPin &&
226
+ req . body . code &&
227
+ user . resetPin . toString ( ) === req . body . code . toString ( )
228
+ ) {
224
229
user . password = user . generateHash ( req . body . password ) ;
225
230
226
231
delete user . resetPin ;
You can’t perform that action at this time.
0 commit comments