Merge pull request #4631 from sbwalker/dev

on .NET MAUI provide message to user if Security Token has not been configured
This commit is contained in:
Shaun Walker 2024-09-18 11:28:30 -04:00 committed by GitHub
commit f352fc5c67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 7 deletions

View File

@ -359,12 +359,6 @@
} }
if (restricted == "") if (restricted == "")
{ {
if (!ShowProgress)
{
_uploading = true;
StateHasChanged();
}
try try
{ {
// upload the files // upload the files
@ -374,7 +368,21 @@
if (PageState.Runtime == Shared.Runtime.Hybrid) if (PageState.Runtime == Shared.Runtime.Hybrid)
{ {
jwt = await UserService.GetTokenAsync(); jwt = await UserService.GetTokenAsync();
if (string.IsNullOrEmpty(jwt))
{
await logger.LogInformation("File Upload Failed From .NET MAUI Due To Missing Security Token. Token Options Must Be Set In User Settings.");
_message = "Security Token Not Specified";
_messagetype = MessageType.Error;
return;
}
} }
if (!ShowProgress)
{
_uploading = true;
StateHasChanged();
}
await interop.UploadFiles(posturl, folder, _guid, SiteState.AntiForgeryToken, jwt); await interop.UploadFiles(posturl, folder, _guid, SiteState.AntiForgeryToken, jwt);
// uploading is asynchronous so we need to poll to determine if uploads are completed // uploading is asynchronous so we need to poll to determine if uploads are completed

View File

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using System.Linq; using System.Linq;
using System.Security.Claims; using System.Security.Claims;
using Oqtane.Shared; using Oqtane.Shared;
using System;
using System.Net; using System.Net;
using Oqtane.Enums; using Oqtane.Enums;
using Oqtane.Infrastructure; using Oqtane.Infrastructure;
@ -386,6 +385,7 @@ namespace Oqtane.Controllers
} }
if (roles != "") roles = ";" + roles; if (roles != "") roles = ";" + roles;
user.Roles = roles; user.Roles = roles;
user.SecurityStamp = User.SecurityStamp();
} }
return user; return user;
} }