Giter Site home page Giter Site logo

operator-mono's Introduction

Operator-Mono Font

A nice code font

operator-mono's People

Contributors

keyding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

operator-mono's Issues

Posting copyrighted content

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.)

why bcrypt.comapre return false when jsonwebtoken store in the cookie

`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

How To Install

Hello ,keyding .
Please Help Me how to install this Font in VS Code .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.