This commit is contained in:
stephb9959
2022-02-22 14:45:11 -08:00
parent ce54855f3f
commit c5f70fdda7
3 changed files with 14 additions and 2 deletions

View File

@@ -95,6 +95,11 @@ namespace OpenWifi {
return BadRequest(RESTAPI::Errors::InvalidEmailAddress);
}
SecurityObjects::UserInfo Existing;
if(StorageService()->SubDB().GetUserByEmail(NewUser.email,Existing)) {
return BadRequest(RESTAPI::Errors::UserAlreadyExists);
}
if(!NewUser.currentPassword.empty()) {
if(!AuthService()->ValidatePassword(NewUser.currentPassword)) {
return BadRequest(RESTAPI::Errors::InvalidPassword);