diff --git a/package.json b/package.json index f15ef15..fc7828b 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "@types/nodemailer": "^1.3.32", "@types/passport": "^0.3.3", "@types/passport-facebook": "^2.1.3", - "@types/request": "0.0.42", + "@types/request": "0.0.45", "@types/supertest": "^2.0.0", "concurrently": "^3.4.0", "jest": "^19.0.2", @@ -91,4 +91,4 @@ "tslint": "^5.0.0", "typescript": "^2.2.2" } -} +} \ No newline at end of file diff --git a/src/config/passport.ts b/src/config/passport.ts index 92d7bc8..2f97871 100644 --- a/src/config/passport.ts +++ b/src/config/passport.ts @@ -6,7 +6,7 @@ import * as _ from "lodash"; // import { User, UserType } from '../models/User'; import { default as User } from "../models/User"; -import {Request, Response, NextFunction} from "express"; +import { Request, Response, NextFunction } from "express"; const LocalStrategy = passportLocal.Strategy; const FacebookStrategy = passportFacebook.Strategy; diff --git a/src/controllers/api.ts b/src/controllers/api.ts index 478cea3..2638130 100644 --- a/src/controllers/api.ts +++ b/src/controllers/api.ts @@ -3,7 +3,7 @@ import * as async from "async"; import * as request from "request"; import * as graph from "fbgraph"; -import {Response, Request, NextFunction} from "express"; +import { Response, Request, NextFunction } from "express"; /** diff --git a/src/controllers/contact.ts b/src/controllers/contact.ts index d4a5067..1de4474 100644 --- a/src/controllers/contact.ts +++ b/src/controllers/contact.ts @@ -1,5 +1,5 @@ import * as nodemailer from "nodemailer"; -import {Request, Response} from "express"; +import { Request, Response } from "express"; const transporter = nodemailer.createTransport({ service: "SendGrid", diff --git a/src/controllers/home.ts b/src/controllers/home.ts index 8fe6526..67a22fa 100644 --- a/src/controllers/home.ts +++ b/src/controllers/home.ts @@ -1,4 +1,4 @@ -import {Request, Response} from "express"; +import { Request, Response } from "express"; /** * GET / diff --git a/src/controllers/user.ts b/src/controllers/user.ts index 7004d3b..b9bcdb8 100644 --- a/src/controllers/user.ts +++ b/src/controllers/user.ts @@ -2,9 +2,9 @@ import * as async from "async"; import * as crypto from "crypto"; import * as nodemailer from "nodemailer"; import * as passport from "passport"; -import {default as User, UserModel, AuthToken} from "../models/User"; -import {Request, Response, NextFunction} from "express"; -import {LocalStrategyInfo} from "passport-local"; +import { default as User, UserModel, AuthToken } from "../models/User"; +import { Request, Response, NextFunction } from "express"; +import { LocalStrategyInfo } from "passport-local"; import { WriteError } from "mongodb"; const request = require("express-validator"); @@ -80,7 +80,7 @@ export let getSignup = (req: Request, res: Response) => { */ export let postSignup = (req: Request, res: Response, next: NextFunction) => { req.assert("email", "Email is not valid").isEmail(); - req.assert("password", "Password must be at least 4 characters long").len(4); + req.assert("password", "Password must be at least 4 characters long").len({ min: 4 }); req.assert("confirmPassword", "Passwords do not match").equals(req.body.password); req.sanitize("email").normalizeEmail({ gmail_remove_dots: false }); @@ -165,7 +165,7 @@ export let postUpdateProfile = (req: Request, res: Response, next: NextFunction) * Update current password. */ export let postUpdatePassword = (req: Request, res: Response, next: NextFunction) => { - req.assert("password", "Password must be at least 4 characters long").len(4); + req.assert("password", "Password must be at least 4 characters long").len({ min: 4 }); req.assert("confirmPassword", "Passwords do not match").equals(req.body.password); const errors = req.validationErrors(); @@ -245,7 +245,7 @@ export let getReset = (req: Request, res: Response, next: NextFunction) => { * Process the reset password request. */ export let postReset = (req: Request, res: Response, next: NextFunction) => { - req.assert("password", "Password must be at least 4 characters long.").len(4); + req.assert("password", "Password must be at least 4 characters long.").len({ min: 4 }); req.assert("confirm", "Passwords must match.").equals(req.body.password); const errors = req.validationErrors(); diff --git a/src/models/User.ts b/src/models/User.ts index dc7008b..22cc542 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -64,8 +64,8 @@ userSchema.pre("save", function save(next) { }); }); -userSchema.methods.comparePassword = function(candidatePassword: string, cb: (err: any, isMatch: any) => {}) { - bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error , isMatch: boolean) => { +userSchema.methods.comparePassword = function (candidatePassword: string, cb: (err: any, isMatch: any) => {}) { + bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error, isMatch: boolean) => { cb(err, isMatch); }); }; @@ -74,7 +74,7 @@ userSchema.methods.comparePassword = function(candidatePassword: string, cb: (er /** * Helper method for getting user's gravatar. */ -userSchema.methods.gravatar = function(size: number) { +userSchema.methods.gravatar = function (size: number) { if (!size) { size = 200; }