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

fit bugs of issue 15 and some other bugs caused by tslint #26

Merged
merged 1 commit into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -91,4 +91,4 @@
"tslint": "^5.0.0",
"typescript": "^2.2.2"
}
}
}
2 changes: 1 addition & 1 deletion src/config/passport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";


/**
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/contact.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/home.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Request, Response} from "express";
import { Request, Response } from "express";

/**
* GET /
Expand Down
12 changes: 6 additions & 6 deletions src/controllers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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 });

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};
Expand All @@ -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;
}
Expand Down