diff --git a/src/auth/AuthManager.ts b/src/auth/AuthManager.ts index f17f204..c2e2347 100644 --- a/src/auth/AuthManager.ts +++ b/src/auth/AuthManager.ts @@ -217,7 +217,7 @@ export class AuthManager { return Promise.resolve({ isLoggedIn, - userName: userName.toLowerCase(), + userName: userName, loginForm }) } diff --git a/src/auth/spec/AuthManager.spec.ts b/src/auth/spec/AuthManager.spec.ts index b17a352..bf064c2 100644 --- a/src/auth/spec/AuthManager.spec.ts +++ b/src/auth/spec/AuthManager.spec.ts @@ -596,7 +596,6 @@ describe('AuthManager', () => { it('return session information when logged in - SAS9 - having full name in html', async () => { const fullname = 'FirstName LastName' - const username = 'firlas' const serverType = ServerType.Sas9 const authManager = new AuthManager( serverUrl, @@ -612,7 +611,7 @@ describe('AuthManager', () => { const response = await authManager.checkSession() expect(response.isLoggedIn).toBeTruthy() - expect(response.userName).toEqual(username) + expect(response.userName).toEqual(fullname) expect(mockedAxios.get).toHaveBeenNthCalledWith( 1, `http://test-server.com/SASStoredProcess`, diff --git a/src/utils/sas9/extractUserNameSas9.ts b/src/utils/sas9/extractUserNameSas9.ts index 93f48fc..8f45d39 100644 --- a/src/utils/sas9/extractUserNameSas9.ts +++ b/src/utils/sas9/extractUserNameSas9.ts @@ -10,7 +10,7 @@ const dictionary = ['Log Off'] * @returns username */ export const extractUserNameSas9 = (response: string) => { - const regex = /"title":\s?".*"/ + const regex = /"title":\s?".*?"/ const matched = response?.match(regex) let username = matched?.[0].split(':')[1].trim()