Skip to content

Commit

Permalink
changed domain on recoverPassowed email link
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl committed Jul 6, 2016
1 parent 611fb59 commit d0c0dfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/api/users/specs/users.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Users', () => {
it('should find the matching email create a recover password doc in the database and send an email', (done) => {
spyOn(Date, 'now').and.returnValue(1000);
let expectedKey = SHA256('admin@admin.com' + 1000).toString();
users.recoverPassword('admin@admin.com')
users.recoverPassword('admin@admin.com', 'domain')
.then(() => {
return fetch(`${dbUrl}/_design/recoverpassword/_view/all?key="${expectedKey}"`);
})
Expand All @@ -56,7 +56,7 @@ describe('Users', () => {
to: 'admin@admin.com',
subject: 'Password recovery',
text: 'To reset your password click the following link:\n' +
'http://localhost:3000/resetpassword/ace2fe3d70340fe4bdba3b5e087b0336e37887f28ac189c8f5b7546f9c5dbdb5'
'domain/resetpassword/ace2fe3d70340fe4bdba3b5e087b0336e37887f28ac189c8f5b7546f9c5dbdb5'
};
expect(mailer.send).toHaveBeenCalledWith(expectedMailOptions);
done();
Expand Down
4 changes: 2 additions & 2 deletions app/api/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
});
},

recoverPassword(email) {
recoverPassword(email, domain) {
let key = SHA256(email + Date.now()).toString();
return request.get(`${dbURL}/_design/users/_view/all`)
.then((results) => {
Expand All @@ -30,7 +30,7 @@ export default {
from: '"Uwazi" <no-reply@uwazi.com>',
to: email,
subject: 'Password recovery',
text: `To reset your password click the following link:\nhttp://localhost:3000/resetpassword/${key}`
text: `To reset your password click the following link:\n${domain}/resetpassword/${key}`
};
mailer.send(mailOptions);
});
Expand Down

0 comments on commit d0c0dfc

Please sign in to comment.