- При регистрации юзер вводит некий пароль
- Генерим случайную соль индивилуально для каждого юзера
- Создаем хеш на основе введенного юзером пароля и соли
- Записываем хеш(не пароль) в БД + соль в отдельном филде
- Юзер вводит в поле авторизации некий пароль
| const puppeteer = require("puppeteer"); | |
| // This works around Discord's security measurements | |
| // to set values on localStorage before we go to discord.com/login | |
| const setDomainLocalStorage = async (browser, url, values) => { | |
| const page = await browser.newPage(); | |
| await page.setRequestInterception(true); | |
| page.on("request", r => { | |
| r.respond({ | |
| status: 200, |
TLDR: Use for...of instead of forEach in asynchronous code.
Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)
For example, the following forEach loop might not do what it appears to do:
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Run ts-mocha File", | |
| "type": "node", | |
| "request": "launch", | |
| "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-mocha", | |
| "runtimeArgs": [ | |
| "${file}" |
| app.get('/video', function(req, res) { | |
| const path = 'assets/sample.mp4' | |
| const stat = fs.statSync(path) | |
| const fileSize = stat.size | |
| const range = req.headers.range | |
| if (range) { | |
| const parts = range.replace(/bytes=/, "").split("-") | |
| const start = parseInt(parts[0], 10) | |
| const end = parts[1] | |
| ? parseInt(parts[1], 10) |
| var mongoose = require('mongoose'); | |
| mongoose.connect('localhost', 'testing_emitUpdate'); | |
| var Schema = mongoose.Schema; | |
| var schema = new Schema({ | |
| name: String | |
| }); | |
| // plumbing | |
| schema.pre('save', function (next) { |
| // import ..... | |
| const inputUploadFile: CSSProperties = { | |
| display: 'none', | |
| }; | |
| const buttonUploadFile: CSSProperties = { | |
| margin: 8, | |
| }; |
| { | |
| "extends": [ | |
| "airbnb", | |
| "prettier", | |
| "prettier/react" | |
| ], | |
| "parser": "babel-eslint", | |
| "parserOptions": { | |
| "ecmaVersion": 8, | |
| "ecmaFeatures": { |