Skip to content

Commit 1761dd1

Browse files
committed
Cleanup reset logic (that will come in another PR)
1 parent 97f2e10 commit 1761dd1

File tree

4 files changed

+3
-130
lines changed

4 files changed

+3
-130
lines changed

src/RestWrite.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,6 @@ RestWrite.prototype.transformUser = function() {
404404
throw new Parse.Error(Parse.Error.USERNAME_TAKEN,
405405
'Account already exists for this username');
406406
}
407-
if (this.config.verifyUserEmails && this.data.email) {
408-
this.data._perishable_token = cryptoUtils.randomString(25);
409-
}
410407
return Promise.resolve();
411408
});
412409
}).then(() => {

src/Routers/UsersRouter.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -158,36 +158,6 @@ export class UsersRouter extends ClassesRouter {
158158
return Promise.resolve(success);
159159
}
160160

161-
handleReset(req) {
162-
if (!req.body.email && req.query.email) {
163-
req.body = req.query;
164-
}
165-
166-
if (!req.body.email) {
167-
throw new Parse.Error(Parse.Error.EMAIL_MISSING,
168-
'email is required.');
169-
}
170-
171-
return req.database.find('_User', {email: req.body.email})
172-
.then((results) => {
173-
if (!results.length) {
174-
throw new Parse.Error(Parse.Error.EMAIL_NOT_FOUND,
175-
'Email not found.');
176-
}
177-
var emailSender = req.info.app && req.info.app.emailSender;
178-
if (!emailSender) {
179-
throw new Error("No email sender function specified");
180-
}
181-
var perishableSessionToken = encodeURIComponent(results[0].perishableSessionToken);
182-
var encodedEmail = encodeURIComponent(req.body.email)
183-
var endpoint = req.config.mount + "/request_password_reset?token=" + perishableSessionToken + "&username=" + encodedEmail;
184-
return emailSender(Constants.RESET_PASSWORD, endpoint,req.body.email);
185-
})
186-
.then(()=>{
187-
return {response:{}};
188-
})
189-
}
190-
191161
mountRoutes() {
192162
this.route('GET', '/users', req => { return this.handleFind(req); });
193163
this.route('POST', '/users', req => { return this.handleCreate(req); });
@@ -197,6 +167,9 @@ export class UsersRouter extends ClassesRouter {
197167
this.route('DELETE', '/users/:objectId', req => { return this.handleDelete(req); });
198168
this.route('GET', '/login', req => { return this.handleLogIn(req); });
199169
this.route('POST', '/logout', req => { return this.handleLogOut(req); });
170+
this.route('POST', '/requestPasswordReset', () => {
171+
throw new Parse.Error(Parse.Error.COMMAND_UNAVAILABLE, 'This path is not implemented yet.');
172+
});
200173
this.route('POST', '/requestPasswordReset', req => this.handleReset(req));
201174
}
202175
}

src/passwordReset.js

Lines changed: 0 additions & 94 deletions
This file was deleted.

src/transform.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ export function transformKeyValue(schema, className, restKey, restValue, options
4242
key = '_updated_at';
4343
timeField = true;
4444
break;
45-
case '_perishable_token':
46-
key = "_perishable_token";
47-
break;
4845
case '_email_verify_token':
4946
key = "_email_verify_token";
5047
break;

0 commit comments

Comments
 (0)