mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(auth) blank password results in inability to authenticate
Found myself in a vicious loop if I failed to type in a password when prompted in Chrome. Every refresh of the page would fall into the criton check with a blank password. Seems Chrome wouldn't clear the headers until I closed the browser and/or switched to a new incognito tab. Probably a user error, but still, this avoided the criton throw.
This commit is contained in:
parent
2164a025f3
commit
eceb0ac2af
1 changed files with 7 additions and 3 deletions
|
|
@ -29,14 +29,18 @@
|
|||
}
|
||||
|
||||
function check(username, password, callback) {
|
||||
var sameName,
|
||||
var BAD_CREDENTIALS = false,
|
||||
sameName,
|
||||
samePass,
|
||||
name = config('username'),
|
||||
pass = config('password'),
|
||||
algo = config('algo');
|
||||
|
||||
sameName = username === name;
|
||||
samePass = pass === criton(password, algo);
|
||||
if (!password)
|
||||
return callback(BAD_CREDENTIALS);
|
||||
|
||||
sameName = username === name;
|
||||
samePass = pass === criton(password, algo);
|
||||
|
||||
callback(sameName && samePass);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue