- При регистрации юзер вводит некий пароль
- Генерим случайную соль индивилуально для каждого юзера
- Создаем хеш на основе введенного юзером пароля и соли
- Записываем хеш(не пароль) в БД + соль в отдельном филде
- Юзер вводит в поле авторизации некий пароль
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:
[alias] | |
delete-merged = git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d |
var nextChar = c=>c?String.fromCharCode(c.charCodeAt(0)+1):'A'; | |
var nextCol = s=>s.replace(/([^Z]?)(Z*)$/, (_,a,z)=>nextChar(a) + z.replace(/Z/g,'A')); | |
//test: | |
nextCol(''); //A | |
nextCol('A'); //B | |
nextCol('Z'); //AA | |
nextCol('AA'); //AB | |
nextCol('XYZ'); //XZA |
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", |
type Constructor<T> = new (...args: any[]) => T; | |
type ModelType<T extends Model<T>> = Constructor<T> & typeof Model; | |
export interface IRepository<T extends Model> { | |
get(id: string): Promise<T| null>; | |
find(where: FindOptions<T>): Promise<T>; | |
create(model: T): Promise<T>; | |
update(key: any, model: T): Promise<T>; | |
} |
openssl req -new -x509 -nodes -newkey rsa:1024 -keyout server.key -out server.crt |