mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
				synced 2025-10-31 02:37:56 +00:00 
			
		
		
		
	Adding protection for enabling MFA when MFA is not available.
This commit is contained in:
		| @@ -6,6 +6,7 @@ | ||||
| #include "StorageService.h" | ||||
| #include "framework/ow_constants.h" | ||||
| #include "SMSSender.h" | ||||
| #include "SMTPMailerService.h" | ||||
| #include "ACLProcessor.h" | ||||
| #include "AuthService.h" | ||||
| #include "RESTAPI/RESTAPI_db_helpers.h" | ||||
| @@ -260,6 +261,18 @@ namespace OpenWifi { | ||||
|                     return BadRequest(RESTAPI::Errors::BadMFAMethod); | ||||
|                 } | ||||
|  | ||||
|                 if( NewUser.userTypeProprietaryInfo.mfa.enabled && | ||||
|                     NewUser.userTypeProprietaryInfo.mfa.method == MFAMETHODS::SMS && | ||||
|                     !SMSSender()->Enabled()) { | ||||
|                     return BadRequest(RESTAPI::Errors::SMSMFANotEnabled); | ||||
|                 } | ||||
|  | ||||
|                 if( NewUser.userTypeProprietaryInfo.mfa.enabled && | ||||
|                     NewUser.userTypeProprietaryInfo.mfa.method == MFAMETHODS::EMAIL && | ||||
|                     !SMTPMailerService()->Enabled()) { | ||||
|                     return BadRequest(RESTAPI::Errors::EMailMFANotEnabled); | ||||
|                 } | ||||
|  | ||||
|                 bool ChangingMFA = | ||||
|                         NewUser.userTypeProprietaryInfo.mfa.enabled && !Existing.userTypeProprietaryInfo.mfa.enabled; | ||||
|                 Existing.userTypeProprietaryInfo.mfa.enabled = NewUser.userTypeProprietaryInfo.mfa.enabled; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 stephb9959
					stephb9959