Migration UI complete.
This commit is contained in:
parent
eb48b92551
commit
6bab5b4723
9 changed files with 45 additions and 14 deletions
|
|
@ -56,24 +56,23 @@ module.exports.post = async function(req, res){
|
|||
//Look for the username in the migration DB
|
||||
const migrationDB = await migrationModel.findOne({user});
|
||||
|
||||
//If this isn't a migration
|
||||
if(migrationDB == null){
|
||||
//Get login attempts
|
||||
const attempts = sessionUtils.getLoginAttempts(user)
|
||||
|
||||
//if we've gone over max attempts
|
||||
if(attempts.count > sessionUtils.throttleAttempts){
|
||||
//tell client it needs a captcha
|
||||
return res.sendStatus(429);
|
||||
}
|
||||
//otherwise
|
||||
}else{
|
||||
//If we found a migration profile
|
||||
if(migrationDB != null){
|
||||
//If the user has a good password
|
||||
if(hashUtils.compareLegacyPassword(pass, migrationDB.pass)){
|
||||
//Redirect to migrate
|
||||
return res.sendStatus(301);
|
||||
}
|
||||
}
|
||||
|
||||
//Get login attempts
|
||||
const attempts = sessionUtils.getLoginAttempts(user)
|
||||
|
||||
//if we've gone over max attempts
|
||||
if(attempts.count > sessionUtils.throttleAttempts){
|
||||
//tell client it needs a captcha
|
||||
return res.sendStatus(429);
|
||||
}
|
||||
}else{
|
||||
res.status(400);
|
||||
return res.send({errors: validResult.array()})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue