Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reports weren't being informed of the user's language #3726

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion CSETWebApi/CSETWeb_Api/CSETWebCore.Helpers/UserAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,29 @@ public LoginResponse AuthenticateStandalone(Login login, ITokenManager tokenMana
// Read the file system for the LOCAL-INSTALLATION file put there at install time
if (!_localInstallationHelper.IsLocalInstallation())
{
// this is not a local install. Return what we know about this user.
var loginUser = _context.USERS.Where(x => x.UserId == int.Parse(tokenManager.Payload("userid"))).FirstOrDefault();

if (loginUser != null)
{
var respUser = new LoginResponse
{
UserId = loginUser.UserId,
Email = login.Email,
Lang = loginUser.Lang,
UserFirstName = loginUser.FirstName,
UserLastName = loginUser.LastName,
IsSuperUser = loginUser.IsSuperUser,
ResetRequired = loginUser.PasswordResetRequired ?? true,
ExportExtension = IOHelper.GetExportFileExtension(login.Scope),
ImportExtensions = IOHelper.GetImportFileExtensions(login.Scope),
LinkerTime = new BuildNumberHelper().GetLinkerTime(),
IsFirstLogin = loginUser.IsFirstLogin ?? false
};

return respUser;
}

return null;
}

Expand Down Expand Up @@ -237,7 +260,7 @@ public LoginResponse AuthenticateStandalone(Login login, ITokenManager tokenMana
string token = _transactionSecurity.GenerateToken(userIdSO, null, login.TzOffset, -1, assessmentId, null, login.Scope);

// Build response object
LoginResponse resp = new LoginResponse
var resp = new LoginResponse
{
Token = token,
Email = primaryEmailSO,
Expand Down
Loading