This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialContext = { username: '', password: '', jwt: '' } | |
// taken from https://www.w3resource.com/javascript/form/email-validation.php | |
const emailReg = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/ | |
// taken from https://stackoverflow.com/questions/19605150/regex-for-password-must-contain-at-least-eight-characters-at-least-one-number-a | |
const passwordReg = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/ | |
function mockAuthenticate(username, password, ms = 1500) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { |