mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 20:13:32 +01:00
web - fix bad credentials lookup
This commit is contained in:
@@ -27,13 +27,6 @@ class LocalStorageCredentialsProvider implements ICredentialsProvider {
|
||||
|
||||
static readonly CREDENTIALS_OPENED_KEY = 'credentials.provider';
|
||||
|
||||
constructor(credentials: ICredential[]) {
|
||||
this._credentials = credentials;
|
||||
for (const { service, account, password } of this._credentials) {
|
||||
this.setPassword(service, account, password);
|
||||
}
|
||||
}
|
||||
|
||||
private _credentials: ICredential[] | undefined;
|
||||
private get credentials(): ICredential[] {
|
||||
if (!this._credentials) {
|
||||
@@ -437,16 +430,20 @@ class WindowIndicator implements IWindowIndicator {
|
||||
window.location.href = `${window.location.origin}?${queryString}`;
|
||||
};
|
||||
|
||||
// Find credentials from DOM
|
||||
// Credentials (with support of predefined ones via meta element)
|
||||
const credentialsProvider = new LocalStorageCredentialsProvider();
|
||||
|
||||
const credentialsElement = document.getElementById('vscode-workbench-credentials');
|
||||
const credentialsElementAttribute = credentialsElement ? credentialsElement.getAttribute('data-settings') : undefined;
|
||||
let credentials = undefined;
|
||||
if (credentialsElementAttribute) {
|
||||
try {
|
||||
credentials = JSON.parse(credentialsElementAttribute);
|
||||
for (const { service, account, password } of credentials) {
|
||||
credentialsProvider.setPassword(service, account, password);
|
||||
}
|
||||
} catch (error) { /* Invalid credentials are passed. Ignore. */ }
|
||||
}
|
||||
const credentialsProvider = new LocalStorageCredentialsProvider(credentials || []);
|
||||
|
||||
// Finally create workbench
|
||||
create(document.body, {
|
||||
|
||||
Reference in New Issue
Block a user