Skip to content

Commit

Permalink
resolve hound issues [Finishes 167730744]
Browse files Browse the repository at this point in the history
  • Loading branch information
conquext committed Aug 23, 2019
1 parent d863803 commit 93e1013
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { errorResponse, successResponse } from '../utils/response';
import Hash from '../utils/hash';
import models from '../models';

const User = models.User;
const Login = models.Login;
const Reset = models.Reset;
const { User, Login, Reset } = models;

const forgotPassword = (req, res) => {
const { errors, isValid } = Validation.validateEmail(req.body);
Expand Down Expand Up @@ -63,7 +61,7 @@ const forgotPassword = (req, res) => {
.then(() =>
successResponse(res, 200, 'Check your mail for further instruction')
)
.catch((error) => errorResponse(res, 500, error));
.catch(error => errorResponse(res, 500, error));
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/database/seed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import models from '../models';

const seedCopyDb = async() => {
const seedCopyDb = async () => {
await models.User.create({
email: 'youremail@andela.com',
role: 'passenger'
Expand Down
8 changes: 5 additions & 3 deletions src/services/sendMail.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import dotenv from 'dotenv';

dotenv.config();

const apiKey = process.env.SENDGRIP_API_KEY;
const env = process.env;
const apiKey = env.SENDGRIP_API_KEY;
const CLIENT_URL = env.NODE_ENV === "test" || "development" ? `http://localhost:${env.PORT}/api` : env.CLIENT_URL;

sgMail.setApiKey(apiKey);

Expand All @@ -16,9 +18,9 @@ const sendResetMail = (user, resetToken) => {
subject: 'Reset Password',
html: `
<p>To reset your password, click link to complete this form:</p>
<a href='${process.env.CLIENT_URL}/resetpassword/${
<a href='${CLIENT_URL}/resetpassword/${
user.id
}?token=${resetToken}'>${process.env.CLIENT_URL}/resetpassword/${
}?token=${resetToken}'>${CLIENT_URL}/resetpassword/${
user.id
}?token=${resetToken}</a>
<p>This link expires in ${expiry} hours<p>
Expand Down

0 comments on commit 93e1013

Please sign in to comment.