mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-02 11:47:56 +00:00
Fixing submfa method
This commit is contained in:
@@ -11,7 +11,8 @@ namespace OpenWifi {
|
|||||||
void RESTAPI_submfa_handler::DoGet() {
|
void RESTAPI_submfa_handler::DoGet() {
|
||||||
SecurityObjects::UserInfo User;
|
SecurityObjects::UserInfo User;
|
||||||
|
|
||||||
if (StorageService()->GetUserById(UserInfo_.userinfo.Id,User)) {
|
std::cout << "submfa get " << UserInfo_.userinfo.Id << " user:" << UserInfo_.userinfo.email << std::endl;
|
||||||
|
if (StorageService()->GetSubUserById(UserInfo_.userinfo.Id,User)) {
|
||||||
Poco::JSON::Object Answer;
|
Poco::JSON::Object Answer;
|
||||||
SecurityObjects::SubMfaConfig MFC;
|
SecurityObjects::SubMfaConfig MFC;
|
||||||
|
|
||||||
@@ -44,9 +45,9 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
if (MFC.type == "disabled") {
|
if (MFC.type == "disabled") {
|
||||||
SecurityObjects::UserInfo User;
|
SecurityObjects::UserInfo User;
|
||||||
StorageService()->GetUserById(UserInfo_.userinfo.Id, User);
|
StorageService()->GetSubUserById(UserInfo_.userinfo.Id, User);
|
||||||
User.userTypeProprietaryInfo.mfa.enabled = false;
|
User.userTypeProprietaryInfo.mfa.enabled = false;
|
||||||
StorageService()->UpdateUserInfo(UserInfo_.userinfo.email, UserInfo_.userinfo.Id, User);
|
StorageService()->UpdateSubUserInfo(UserInfo_.userinfo.email, UserInfo_.userinfo.Id, User);
|
||||||
|
|
||||||
Poco::JSON::Object Answer;
|
Poco::JSON::Object Answer;
|
||||||
MFC.to_json(Answer);
|
MFC.to_json(Answer);
|
||||||
@@ -54,10 +55,10 @@ namespace OpenWifi {
|
|||||||
} else if (MFC.type == "email") {
|
} else if (MFC.type == "email") {
|
||||||
SecurityObjects::UserInfo User;
|
SecurityObjects::UserInfo User;
|
||||||
|
|
||||||
StorageService()->GetUserById(UserInfo_.userinfo.Id, User);
|
StorageService()->GetSubUserById(UserInfo_.userinfo.Id, User);
|
||||||
User.userTypeProprietaryInfo.mfa.enabled = true;
|
User.userTypeProprietaryInfo.mfa.enabled = true;
|
||||||
User.userTypeProprietaryInfo.mfa.method = "email";
|
User.userTypeProprietaryInfo.mfa.method = "email";
|
||||||
StorageService()->UpdateUserInfo(UserInfo_.userinfo.email, UserInfo_.userinfo.Id, User);
|
StorageService()->UpdateSubUserInfo(UserInfo_.userinfo.email, UserInfo_.userinfo.Id, User);
|
||||||
|
|
||||||
Poco::JSON::Object Answer;
|
Poco::JSON::Object Answer;
|
||||||
MFC.to_json(Answer);
|
MFC.to_json(Answer);
|
||||||
@@ -84,7 +85,7 @@ namespace OpenWifi {
|
|||||||
if (SMSSender()->CompleteValidation(MFC.sms, ChallengeCode, UserInfo_.userinfo.email)) {
|
if (SMSSender()->CompleteValidation(MFC.sms, ChallengeCode, UserInfo_.userinfo.email)) {
|
||||||
SecurityObjects::UserInfo User;
|
SecurityObjects::UserInfo User;
|
||||||
|
|
||||||
StorageService()->GetUserById(UserInfo_.userinfo.Id, User);
|
StorageService()->GetSubUserById(UserInfo_.userinfo.Id, User);
|
||||||
User.userTypeProprietaryInfo.mfa.enabled = true;
|
User.userTypeProprietaryInfo.mfa.enabled = true;
|
||||||
User.userTypeProprietaryInfo.mfa.method = "sms";
|
User.userTypeProprietaryInfo.mfa.method = "sms";
|
||||||
SecurityObjects::MobilePhoneNumber PhoneNumber;
|
SecurityObjects::MobilePhoneNumber PhoneNumber;
|
||||||
@@ -93,7 +94,7 @@ namespace OpenWifi {
|
|||||||
PhoneNumber.verified = true;
|
PhoneNumber.verified = true;
|
||||||
User.userTypeProprietaryInfo.mobiles.clear();
|
User.userTypeProprietaryInfo.mobiles.clear();
|
||||||
User.userTypeProprietaryInfo.mobiles.push_back(PhoneNumber);
|
User.userTypeProprietaryInfo.mobiles.push_back(PhoneNumber);
|
||||||
StorageService()->UpdateUserInfo(UserInfo_.userinfo.email, UserInfo_.userinfo.Id, User);
|
StorageService()->UpdateSubUserInfo(UserInfo_.userinfo.email, UserInfo_.userinfo.Id, User);
|
||||||
|
|
||||||
Poco::JSON::Object Answer;
|
Poco::JSON::Object Answer;
|
||||||
MFC.to_json(Answer);
|
MFC.to_json(Answer);
|
||||||
|
|||||||
Reference in New Issue
Block a user