Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit ccdfd33

Browse files
author
Bowden Kelly
authored
Merge pull request #26 from cobola/master
fit bugs of issue 15 and some other bugs caused by tslint
2 parents e0f03d6 + 6f17850 commit ccdfd33

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"@types/nodemailer": "^1.3.32",
8080
"@types/passport": "^0.3.3",
8181
"@types/passport-facebook": "^2.1.3",
82-
"@types/request": "0.0.42",
82+
"@types/request": "0.0.45",
8383
"@types/supertest": "^2.0.0",
8484
"concurrently": "^3.4.0",
8585
"jest": "^19.0.2",
@@ -91,4 +91,4 @@
9191
"tslint": "^5.0.0",
9292
"typescript": "^2.2.2"
9393
}
94-
}
94+
}

src/config/passport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as _ from "lodash";
66

77
// import { User, UserType } from '../models/User';
88
import { default as User } from "../models/User";
9-
import {Request, Response, NextFunction} from "express";
9+
import { Request, Response, NextFunction } from "express";
1010

1111
const LocalStrategy = passportLocal.Strategy;
1212
const FacebookStrategy = passportFacebook.Strategy;

src/controllers/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as async from "async";
44
import * as request from "request";
55
import * as graph from "fbgraph";
6-
import {Response, Request, NextFunction} from "express";
6+
import { Response, Request, NextFunction } from "express";
77

88

99
/**

src/controllers/contact.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as nodemailer from "nodemailer";
2-
import {Request, Response} from "express";
2+
import { Request, Response } from "express";
33

44
const transporter = nodemailer.createTransport({
55
service: "SendGrid",

src/controllers/home.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Request, Response} from "express";
1+
import { Request, Response } from "express";
22

33
/**
44
* GET /

src/controllers/user.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as async from "async";
22
import * as crypto from "crypto";
33
import * as nodemailer from "nodemailer";
44
import * as passport from "passport";
5-
import {default as User, UserModel, AuthToken} from "../models/User";
6-
import {Request, Response, NextFunction} from "express";
7-
import {LocalStrategyInfo} from "passport-local";
5+
import { default as User, UserModel, AuthToken } from "../models/User";
6+
import { Request, Response, NextFunction } from "express";
7+
import { LocalStrategyInfo } from "passport-local";
88
import { WriteError } from "mongodb";
99
const request = require("express-validator");
1010

@@ -80,7 +80,7 @@ export let getSignup = (req: Request, res: Response) => {
8080
*/
8181
export let postSignup = (req: Request, res: Response, next: NextFunction) => {
8282
req.assert("email", "Email is not valid").isEmail();
83-
req.assert("password", "Password must be at least 4 characters long").len(4);
83+
req.assert("password", "Password must be at least 4 characters long").len({ min: 4 });
8484
req.assert("confirmPassword", "Passwords do not match").equals(req.body.password);
8585
req.sanitize("email").normalizeEmail({ gmail_remove_dots: false });
8686

@@ -165,7 +165,7 @@ export let postUpdateProfile = (req: Request, res: Response, next: NextFunction)
165165
* Update current password.
166166
*/
167167
export let postUpdatePassword = (req: Request, res: Response, next: NextFunction) => {
168-
req.assert("password", "Password must be at least 4 characters long").len(4);
168+
req.assert("password", "Password must be at least 4 characters long").len({ min: 4 });
169169
req.assert("confirmPassword", "Passwords do not match").equals(req.body.password);
170170

171171
const errors = req.validationErrors();
@@ -245,7 +245,7 @@ export let getReset = (req: Request, res: Response, next: NextFunction) => {
245245
* Process the reset password request.
246246
*/
247247
export let postReset = (req: Request, res: Response, next: NextFunction) => {
248-
req.assert("password", "Password must be at least 4 characters long.").len(4);
248+
req.assert("password", "Password must be at least 4 characters long.").len({ min: 4 });
249249
req.assert("confirm", "Passwords must match.").equals(req.body.password);
250250

251251
const errors = req.validationErrors();

src/models/User.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ userSchema.pre("save", function save(next) {
6464
});
6565
});
6666

67-
userSchema.methods.comparePassword = function(candidatePassword: string, cb: (err: any, isMatch: any) => {}) {
68-
bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error , isMatch: boolean) => {
67+
userSchema.methods.comparePassword = function (candidatePassword: string, cb: (err: any, isMatch: any) => {}) {
68+
bcrypt.compare(candidatePassword, this.password, (err: mongoose.Error, isMatch: boolean) => {
6969
cb(err, isMatch);
7070
});
7171
};
@@ -74,7 +74,7 @@ userSchema.methods.comparePassword = function(candidatePassword: string, cb: (er
7474
/**
7575
* Helper method for getting user's gravatar.
7676
*/
77-
userSchema.methods.gravatar = function(size: number) {
77+
userSchema.methods.gravatar = function (size: number) {
7878
if (!size) {
7979
size = 200;
8080
}

0 commit comments

Comments
 (0)