Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
var flattenObject = function(ob) { | |
var toReturn = {}; | |
for (var i in ob) { | |
if (!ob.hasOwnProperty(i)) continue; | |
if ((typeof ob[i]) == 'object') { | |
var flatObject = flattenObject(ob[i]); | |
for (var x in flatObject) { | |
if (!flatObject.hasOwnProperty(x)) continue; |
<!-- WRAPPER TABLE --> | |
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="wrappertable" style="table-layout:fixed;"> | |
<tr> | |
<!-- | |
ALIGNING LAYOUTS TO THE CENTER: | |
In some cases, you may want the whole email layout to be centered (mainly for desktop clients). | |
Using the wrapping table cell approach is a clean way of doing it, removing the need for any <center> or <div> tags. | |
It does mean however you'll need to use the align attribute on all table cells within to avoid content being centered. | |
--> | |
<td align="center" valign="top" id="wrappercell"> |
import React, { Component } from 'react'; | |
import axios from 'axios'; | |
class Example extends Component { | |
signal = axios.CancelToken.source(); | |
state = { | |
isLoading: false, | |
user: {}, | |
} |
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
const fs = require('fs'); // Include File System Module to project | |
let listOfNames; // Initialization of variable | |
let pathToListOfNames = './example.txt'; // Path to text file with list of names | |
let pathToFiles = './media/images'; // Path to files which need to rename | |
let formatFiles = 'jpg'; // Specify your image format (Example: jpg, png, gif, etc.) | |
try { | |
listOfNames = fs.readFileSync(pathToListOfNames, 'utf-8') | |
.split('\n'); // Reading a file by strings and splitting it into an array by '\n' |
const rot13 = message => { | |
const a = message.split(''); | |
return a.map(s => { | |
const c = s.charCodeAt(); | |
if (c <= 65 || c >= 123 || s === ' ') return s; | |
return String.fromCharCode( | |
c <= 78 && c < 90 || c >= 97 && c < 110 ? c+13 : c-13 | |
); | |
}).join(''); | |
} |
function jsonReturner() { | |
return [ | |
{ | |
"albumId": 1, | |
"id": 1, | |
"title": "accusamus beatae ad facilis cum similique qui sunt", | |
"url": "https://via.placeholder.com/600/92c952", | |
"thumbnailUrl": "https://via.placeholder.com/150/92c952" | |
}, | |
{ |
function makeSoup() { | |
const pot = boilPot(); | |
chopCarrots(); | |
chopOnions(); | |
await pot; | |
addCarrots(); | |
await letPotKeepBoiling(5); | |
addOnions(); | |
await letPotKeepBoiling(10); | |
console.log("Your vegetable soup is ready!"); |