Skip to content

Commit 344e139

Browse files
committed
directly using updatePassword for resetPassword
1 parent 4b09305 commit 344e139

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/GraphQL/loaders/usersMutations.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as objectsMutations from '../helpers/objectsMutations';
55
import { OBJECT } from './defaultGraphQLTypes';
66
import { getUserFromSessionToken } from './usersQueries';
77
import { transformTypes } from '../transformers/mutation';
8+
import Parse from 'parse/node';
89

910
const usersRouter = new UsersRouter();
1011

@@ -284,18 +285,19 @@ const load = parseGraphQLSchema => {
284285
},
285286
},
286287
mutateAndGetPayload: async ({ username, password, token }, context) => {
287-
const { config, auth, info } = context;
288-
await usersRouter.handleResetPassword({
289-
body: {
290-
username,
291-
password,
292-
token,
293-
},
294-
config,
295-
auth,
296-
info,
297-
});
288+
const { config } = context;
289+
if (!username) {
290+
throw new Parse.Error(Parse.Error.USERNAME_MISSING, 'you must provide a username');
291+
}
292+
if (!password) {
293+
throw new Parse.Error(Parse.Error.PASSWORD_MISSING, 'you must provide a password');
294+
}
295+
if (!token) {
296+
throw new Parse.Error(Parse.Error.OTHER_CAUSE, 'you must provide a token');
297+
}
298298

299+
const userController = config.userController;
300+
await userController.updatePassword(username, token, password);
299301
return { ok: true };
300302
},
301303
});

0 commit comments

Comments
 (0)