mirror of
https://github.com/microsoft/TypeScript-Node-Starter.git
synced 2025-11-08 14:47:28 +00:00
fix conflicts
This commit is contained in:
6435
package-lock.json
generated
6435
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ import passportFacebook from "passport-facebook";
|
||||
import _ from "lodash";
|
||||
|
||||
// import { User, UserType } from '../models/User';
|
||||
import { default as User } from "../models/User";
|
||||
import { User } from "../models/User";
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
|
||||
const LocalStrategy = passportLocal.Strategy;
|
||||
|
||||
@@ -2,7 +2,7 @@ import async from "async";
|
||||
import crypto from "crypto";
|
||||
import nodemailer from "nodemailer";
|
||||
import passport from "passport";
|
||||
import { default as User, UserModel, AuthToken } from "../models/User";
|
||||
import { User, UserDocument, AuthToken } from "../models/User";
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
import { IVerifyOptions } from "passport-local";
|
||||
import { WriteError } from "mongodb";
|
||||
@@ -39,7 +39,7 @@ export let postLogin = (req: Request, res: Response, next: NextFunction) => {
|
||||
return res.redirect("/login");
|
||||
}
|
||||
|
||||
passport.authenticate("local", (err: Error, user: UserModel, info: IVerifyOptions) => {
|
||||
passport.authenticate("local", (err: Error, user: UserDocument, info: IVerifyOptions) => {
|
||||
if (err) { return next(err); }
|
||||
if (!user) {
|
||||
req.flash("errors", info.message);
|
||||
@@ -140,7 +140,7 @@ export let postUpdateProfile = (req: Request, res: Response, next: NextFunction)
|
||||
return res.redirect("/account");
|
||||
}
|
||||
|
||||
User.findById(req.user.id, (err, user: UserModel) => {
|
||||
User.findById(req.user.id, (err, user: UserDocument) => {
|
||||
if (err) { return next(err); }
|
||||
user.email = req.body.email || "";
|
||||
user.profile.name = req.body.name || "";
|
||||
@@ -176,7 +176,7 @@ export let postUpdatePassword = (req: Request, res: Response, next: NextFunction
|
||||
return res.redirect("/account");
|
||||
}
|
||||
|
||||
User.findById(req.user.id, (err, user: UserModel) => {
|
||||
User.findById(req.user.id, (err, user: UserDocument) => {
|
||||
if (err) { return next(err); }
|
||||
user.password = req.body.password;
|
||||
user.save((err: WriteError) => {
|
||||
@@ -278,7 +278,7 @@ export let postReset = (req: Request, res: Response, next: NextFunction) => {
|
||||
});
|
||||
});
|
||||
},
|
||||
function sendResetPasswordEmail(user: UserModel, done: Function) {
|
||||
function sendResetPasswordEmail(user: UserDocument, done: Function) {
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: "SendGrid",
|
||||
auth: {
|
||||
@@ -352,7 +352,7 @@ export let postForgot = (req: Request, res: Response, next: NextFunction) => {
|
||||
});
|
||||
});
|
||||
},
|
||||
function sendForgotPasswordEmail(token: AuthToken, user: UserModel, done: Function) {
|
||||
function sendForgotPasswordEmail(token: AuthToken, user: UserDocument, done: Function) {
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: "SendGrid",
|
||||
auth: {
|
||||
|
||||
@@ -2,7 +2,7 @@ import bcrypt from "bcrypt-nodejs";
|
||||
import crypto from "crypto";
|
||||
import mongoose from "mongoose";
|
||||
|
||||
export type UserModel = mongoose.Document & {
|
||||
export type UserDocument = mongoose.Document & {
|
||||
email: string,
|
||||
password: string,
|
||||
passwordResetToken: string,
|
||||
@@ -88,6 +88,4 @@ userSchema.methods.gravatar = function (size: number) {
|
||||
return `https://gravatar.com/avatar/${md5}?s=${size}&d=retro`;
|
||||
};
|
||||
|
||||
// export const User: UserType = mongoose.model<UserType>('User', userSchema);
|
||||
const User = mongoose.model("User", userSchema);
|
||||
export default User;
|
||||
export const User = mongoose.model<UserDocument>("User", userSchema);
|
||||
|
||||
Reference in New Issue
Block a user