A nice code font
keyding / operator-mono Goto Github PK
View Code? Open in Web Editor NEWA nice code font
A nice code font
The fonts in this repo are copyright. You can read the EULA here. Posting them on GitHub is unethical and illegal. Please take them down. (I know you can't do anything about the ~200 forks.)
I was just wondering if the fonts in this repo are legally OK to use. Thanks!
`const express = require('express');
const bcrypt = require('bcryptjs');
const schema = require('../database/schema/accountSchema');
const router = express.Router();
// Endpoint to handle user login
router.post('/loginn', async (req, res) => {
try {
require('../database/connectmongo.js');
const { email, password } = req.body;
// Check if both email and password are provided
if (!email || !password) {
return res.status(423).json({ message: 'Please provide both email and password.' });
}
// Find user by email
const user = await schema.findOne({ email });
// If user doesn't exist
if (!user) {
return res.status(401).json({ message: 'Invalid email or password.' });
}
const hashedPassword = await bcrypt.hash(password, 10);
console.log(hashedPassword);
// Compare entered password with stored hashed password
const isPasswordValid = await bcrypt.compare(password, user.password);
console.log(isPasswordValid); // first time logout and return true after removing cookie always return false
if (!isPasswordValid) {
return res.status(401).json({ message: 'Incorrect email or password.' });
}
const token = await user.generateAuthentication();
res.cookie('token', token, {
expires: new Date(Date.now() + 1000 * 60 * 60 * 24),
httpOnly: true
})
return res.status(200).json({ message: 'Login successful.' });
} catch (error) {
console.error(error);
return res.status(500).json({ message: 'An error occurred while logging into the account.' });
}
});
module.exports = router;`
const mongoose = require('mongoose');
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const signUpSchema = mongoose.Schema({
email: {
type: String,
required: true
},
password: {
type: String,
required: true,
minlength: 7
},
tokens: [
{
token: {
type: String,
required: true
}
}
]
});
// Encoded password before saving in database
signUpSchema.pre('save', async function (next) {
try {
this.password = await bcrypt.hash(this.password, 10);
} catch (error) {
console.log({ eroor: error.message });
}
next();
})
signUpSchema.methods.generateAuthentication = async function () {
try {
const token = await jwt.sign({ _id: this._id.toString(), password: this.password}, process.env.SECRET_KEY, {
expiresIn: 5000
})
this.tokens = this.tokens.concat({ token });
await this.save();
return token;
} catch (error) {
console.log(error);
}
}
const schema = new mongoose.model("login", signUpSchema);
module.exports = schema;`
i am creating a login form and issue is facing when i generate authentication token and store in the cookie after store cookie in the browser again i can't login the response have invalid email or password i debug this code but i analyze after storing token in the browser bcrypt.compare function does not match with the password even when i am debugging this code i comment generate token code it's perfect working how can i tackle with this problem anyone explain me
Hello ,keyding .
Please Help Me how to install this Font in VS Code .
I highly doubt you have a license to republish these files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.