mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2026-01-27 10:23:15 +00:00
Updating to new error framework.
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
// Created by stephane bourque on 2021-10-11.
|
||||
//
|
||||
|
||||
#ifndef OWSEC_MFASERVER_H
|
||||
#define OWSEC_MFASERVER_H
|
||||
#pragma once
|
||||
|
||||
#include "framework/MicroService.h"
|
||||
#include "Poco/JSON/Object.h"
|
||||
@@ -63,4 +62,3 @@ namespace OpenWifi {
|
||||
inline auto MFAServer() { return MFAServer::instance(); }
|
||||
}
|
||||
|
||||
#endif //OWSEC_MFASERVER_H
|
||||
|
||||
@@ -313,6 +313,7 @@ namespace OpenWifi {
|
||||
}
|
||||
}
|
||||
|
||||
Existing.modified = OpenWifi::Now();
|
||||
if(StorageService()->UserDB().UpdateUserInfo(UserInfo_.userinfo.email,Id,Existing)) {
|
||||
SecurityObjects::UserInfo NewUserInfo;
|
||||
StorageService()->UserDB().GetUserByEmail(UserInfo_.userinfo.email,NewUserInfo);
|
||||
|
||||
@@ -148,21 +148,50 @@ namespace OpenWifi::RESTAPI::Errors {
|
||||
static const struct msg ProvServiceNotAvailable{1102,"Provisioning service not available yet."};
|
||||
static const struct msg SSIDInvalidPassword{1103,"Invalid password length. Must be 8 characters or greater, and a maximum of 32 characters."};
|
||||
static const struct msg InvalidStartingIPAddress{1104,"Invalid starting/ending IP address."};
|
||||
static const struct msg SubnetFormatError{1105,"Subnet must be in format like 192.168.1.1/24"};
|
||||
static const struct msg DeviceModeError{1106,"Device mode subnet must be of the form 192.168.1.1/24"};
|
||||
static const struct msg SubnetFormatError{1105,"Subnet must be in format like 192.168.1.1/24."};
|
||||
static const struct msg DeviceModeError{1106,"Device mode subnet must be of the form 192.168.1.1/24."};
|
||||
|
||||
static const struct msg BadDeviceMode{1107,"Mode must be bridge, nat, or manual"};
|
||||
static const struct msg DefaultGatewayFormat{1108,"Default gateway must be in format like 192.168.1.1"};
|
||||
static const struct msg PrimaryDNSFormat{1109,"Primary DNS must be an IP address i.e. 192.168.1.1"};
|
||||
static const struct msg BadDeviceMode{1107,"Mode must be bridge, nat, or manual."};
|
||||
static const struct msg DefaultGatewayFormat{1108,"Default gateway must be in format like 192.168.1.1."};
|
||||
static const struct msg PrimaryDNSFormat{1109,"Primary DNS must be an IP address i.e. 192.168.1.1."};
|
||||
|
||||
static const struct msg SecondaryDNSFormat{1110,"Secondary DNS must be an IP address i.e. 192.168.1.1"};
|
||||
static const struct msg BadConnectionType{1111,"Internet Connection must be automatic, bridge, pppoe, or manual"};
|
||||
static const struct msg InvalidDeviceID{1112,"Invalid deviceID"};
|
||||
static const struct msg InvalidVisibilityAttribute{1113,"Invalid visibility attribute"};
|
||||
static const struct msg UnknownConfigurationSection{1114,"Unknown section"};
|
||||
static const struct msg SecondaryDNSFormat{1110,"Secondary DNS must be an IP address i.e. 192.168.1.1."};
|
||||
static const struct msg BadConnectionType{1111,"Internet Connection must be automatic, bridge, pppoe, or manual."};
|
||||
static const struct msg InvalidDeviceID{1112,"Invalid deviceID."};
|
||||
static const struct msg InvalidVisibilityAttribute{1113,"Invalid visibility attribute."};
|
||||
static const struct msg UnknownConfigurationSection{1114,"Unknown section."};
|
||||
|
||||
static const struct msg CannotValidatePhoneNumber{1115,"Phone number could not be validated."};
|
||||
static const struct msg RootUsersNoOwners{1116,"ROOT users may not have owners."};
|
||||
static const struct msg PartnerMustHaveEntity{1118,"Partner user must belong to an entity."};
|
||||
static const struct msg RootCannotModifyUsers{1119,"ROOT may not modify user roles."};
|
||||
|
||||
static const struct msg CertificateNotIssued{1120,"Certificate was not issued."};
|
||||
static const struct msg IncompleteCertificate{1121,"Incomplete certificate information. Cannot be downloaded. You must delete and recreate."};
|
||||
static const struct msg InvalidCertificateType{1122,"Invalid certificate type."};
|
||||
static const struct msg InvalidDeviceName{1123,"Invalid device name."};
|
||||
|
||||
static const struct msg InvalidRedirectorName{1124,"Invalid redirector name"};
|
||||
static const struct msg CommonNameAlreadyExists{1125,"A device/server of this name already exists"};
|
||||
static const struct msg CertificateAlreadyExists{1126,"A certificate for this device already exists."};
|
||||
static const struct msg CannotCreateCertTryAgain{1127,"Device certificate could not be created. Please try later."};
|
||||
static const struct msg CouldNotRevoke{1128,"Certificate could not be revoked."};
|
||||
|
||||
static const struct msg CouldNotModifyCert{1129,"Certificate could not me modified. Please verify the information you supplied."};
|
||||
static const struct msg BatchCertNoCreated{1130,"Certificates have not been created for this batch."};
|
||||
static const struct msg BatchTooBig{1131,"Illegal number of MAC Addresses: must be between 1 and 1000."};
|
||||
|
||||
static const struct msg OutstandingJobs{1132,"Batch has running outstanding jobs. Please wait until job is finished."};
|
||||
static const struct msg InvalidSMSNotificationList{1133,"Invalid SMS Notification list."};
|
||||
static const struct msg InvalidEMailNotificationList{1134,"Invalid email Notification list."};
|
||||
static const struct msg CannotChangeCommanNames{1135,"You cannot provide new/modified common names after jobs have been run for a batch."};
|
||||
static const struct msg FailedToVerifyDigicert{1136,"Failed to verify the DigiCert information provided."};
|
||||
static const struct msg CouldNotPerformCommand{1137,"Could not perform command."};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace OpenWifi::RESTAPI::Protocol {
|
||||
static const char * CAPABILITIES = "capabilities";
|
||||
static const char * LOGS = "logs";
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace OpenWifi {
|
||||
|
||||
if(!PasswordHashedAlready) {
|
||||
NewUser.id = MicroService::CreateUUID();
|
||||
NewUser.creationDate = std::time(nullptr);
|
||||
NewUser.creationDate = OpenWifi::Now();
|
||||
}
|
||||
|
||||
// if there is a password, we assume that we do not want email verification,
|
||||
@@ -130,7 +130,7 @@ namespace OpenWifi {
|
||||
NewUser.currentPassword = AuthService()->ComputeNewPasswordHash(NewUser.email,NewUser.currentPassword);
|
||||
NewUser.lastPasswords.clear();
|
||||
NewUser.lastPasswords.push_back(NewUser.currentPassword);
|
||||
NewUser.lastPasswordChange = std::time(nullptr);
|
||||
NewUser.lastPasswordChange = OpenWifi::Now();
|
||||
NewUser.validated = true;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ namespace OpenWifi {
|
||||
if(Value.empty()) {
|
||||
User.avatar = "0";
|
||||
} else {
|
||||
User.avatar = std::to_string(std::time(nullptr));
|
||||
User.avatar = std::to_string(OpenWifi::Now());
|
||||
}
|
||||
return UpdateRecord("id",Id,User);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ namespace OpenWifi {
|
||||
auto tId{Id};
|
||||
|
||||
std::string St1{"update " + TableName_ + " set lastLogin=? where id=?"};
|
||||
uint64_t Now=std::time(nullptr);
|
||||
uint64_t Now=OpenWifi::Now();
|
||||
Update << ConvertParams(St1),
|
||||
Poco::Data::Keywords::use(Now),
|
||||
Poco::Data::Keywords::use(tId);
|
||||
|
||||
Reference in New Issue
Block a user