Move return so record gets created before URL.

This commit is contained in:
Adam Ierymenko 2021-08-10 11:22:29 -04:00
parent 20050662b2
commit 461810b06a
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3

View File

@ -1361,14 +1361,13 @@ void EmbeddedNetworkController::_request(
bool networkSSOEnabled = OSUtils::jsonBool(network["ssoEnabled"], false);
bool memberSSOExempt = OSUtils::jsonBool(member["ssoExempt"], false);
std::string authenticationURL;
if (networkSSOEnabled && !memberSSOExempt) {
authenticationURL = _db.getSSOAuthURL(member, _ssoRedirectURL);
std::string memberId = member["id"];
fprintf(stderr, "ssoEnabled && !ssoExempt %s-%s\n", nwids, memberId.c_str());
uint64_t authenticationExpiryTime = (int64_t)OSUtils::jsonInt(member["authenticationExpiryTime"], 0);
fprintf(stderr, "authExpiryTime: %lld\n", authenticationExpiryTime);
if (authenticationExpiryTime >= now) {
if (authenticationExpiryTime < now) {
if (!authenticationURL.empty()) {
Dictionary<3072> authInfo;
authInfo.add("aU", authenticationURL.c_str());
@ -1376,8 +1375,8 @@ void EmbeddedNetworkController::_request(
DB::cleanMember(member);
_db.save(member,true);
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_AUTHENTICATION_REQUIRED, authInfo.data(), authInfo.sizeBytes());
return;
}
return;
} else if (authorized) {
_db.memberWillExpire(authenticationExpiryTime, nwid, identity.address().toInt());
}