mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-14 23:50:06 +00:00
fix: if username is not present in SAS9, derive it with full name
This commit is contained in:
@@ -172,10 +172,22 @@ export class AuthManager {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private extractUserName = (response: any): string =>
|
private extractUserName = (response: any): string => {
|
||||||
this.serverType === 'SASVIYA'
|
switch (this.serverType) {
|
||||||
? response?.id
|
case ServerType.SasViya:
|
||||||
: response?.match(/"title":"Log Off [0-1a-zA-Z]*"/)?.[0].slice(17, -1)
|
return response?.id
|
||||||
|
case ServerType.Sas9:
|
||||||
|
const matched = response?.match(/"title":"Log Off [0-1a-zA-Z ]*"/)
|
||||||
|
const username = matched?.[0].slice(17, -1)
|
||||||
|
|
||||||
|
if (username.length === 6) return username
|
||||||
|
|
||||||
|
return username
|
||||||
|
.split(' ')
|
||||||
|
.map((name: string) => name.slice(0, 3).toLowerCase())
|
||||||
|
.join('')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private getLoginForm(response: any) {
|
private getLoginForm(response: any) {
|
||||||
const pattern: RegExp = /<form.+action="(.*Logon[^"]*).*>/
|
const pattern: RegExp = /<form.+action="(.*Logon[^"]*).*>/
|
||||||
|
|||||||
Reference in New Issue
Block a user