Started work on migration UI. Improved email handling.

This commit is contained in:
rainbow napkin 2025-10-16 08:25:13 -04:00
parent bddbd9cd36
commit eb48b92551
9 changed files with 252 additions and 23 deletions

View file

@ -316,6 +316,12 @@ migrationSchema.statics.consumeByUsername = async function(ip, migration){
//Pull migration doc by case-insensitive username
const migrationDB = await this.findOne({user: new RegExp(migration.user, 'i')});
//If we have no migration document
if(migrationDB == null){
//Bitch and moan
throw loggerUtils.exceptionSmith("Incorrect username/password.", "migration");
}
//Wait on the miration DB token to be consumed
await migrationDB.consume(ip, migration);
}
@ -359,7 +365,7 @@ migrationSchema.methods.consume = async function(ip, migration){
await newUser.tattooIPRecord(ip);
//if we submitted an email
if(this.email != null && this.email != ''){
if(this.email != null && validator.isEmail(this.email)){
//Generate new email change request
const requestDB = await emailChangeModel.create({user: newUser._id, newEmail: this.email, ipHash: ip});