Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Rowan-Paul/gwentapi. API for Rowan-Paul/GWENTcards repo old.gwentcards.net
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142const mongoose = require('mongoose')const bcrypt = require('bcryptjs')
const UserSchema = new mongoose.Schema({ username: { type: String, required: true, }, email: { type: String, required: true, }, password: { type: String, required: true, }, signUpDate: { type: Date, default: Date.now(), required: true, }, collected: { type: [], required: true, }, verified: { type: Boolean, required: true, default: false, },})
UserSchema.methods.generateHash = function (password) { return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null)}
UserSchema.methods.validPassword = function (password) { return bcrypt.compareSync(password, this.password)}
module.exports = mongoose.model('User', UserSchema)