Added reset password dialog upon SQL Server expired password error (#21295)

* Added initial password connection dialog box

* made small changes

* more preliminary work

* more WIP changes

* more cleanup done

* added dialog instantiation

* added placeholder dialog window

* added changePasswordController

* made some changes to changePasswordController

* some changes made

* added more changes

* more changes made to dialogue

* added password confirm box

* added WIP change password function

* small changes made to API

* small changes for test

* added  uri

* added valid password

* added TODO comments

* added small change to connectionManagementService

* added connectionManagementService password change

* added comment on what to do next

* made some simplification of change password

* added response callback

* added fixes to protocol

* added throw error for passwordChangeResult

* WIP added call to self after password change

* WIP changes to implementing new password change dialog

* added changes to passwordChangeDialog

* added launchChangePasswordDialog

* remove erroneous css

* added working dialog

* removed old password change dialog

* fixed space

* added checkbox option to passwordChangeDialog

* added test signatures

* added error handling

* added some changes

* added changes to HTML for passwordChangeDialog

* added CSS to passwordChangeDialog

* added display none for matching passwords

* added documentation changes

* small cleanup

* added working error catch and retry

* added await

* added recovery instructions

* Added ok button hide for button click.

* added loading spinner

* fixed for semicolon

* added updated message

* Added message change

* added minor fixes

* added small fixes

* made more changes

* renamed messages to errorDetails

* added styling to passwordChangeDialog

* simplified error message

* changed comment

* modified azdata to be consistent

* small changes

* change to azdata for consistency

* added clarification for provider

* removed additional instructions

* Added new dialog title

* addressed feedback

* added comments

* added changes
This commit is contained in:
Alex Ma
2022-12-07 14:27:01 -08:00
committed by GitHub
parent db329049ff
commit cffba368a9
14 changed files with 275 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { CmsConnectionController } from 'sql/workbench/services/connection/browser/cmsConnectionController';
import { PasswordChangeDialog } from 'sql/workbench/services/connection/browser/passwordChangeDialog';
import { entries } from 'sql/base/common/collections';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
@@ -241,6 +242,14 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
}
/**
* Calls the default connect function (used by password reset dialog)
*/
public async callDefaultOnConnect(connection: IConnectionProfile, params: INewConnectionParams): Promise<void> {
// Needed for password reset dialog to connect after changing password.
return this.handleDefaultOnConnect(params, connection);
}
private async handleDefaultOnConnect(params: INewConnectionParams, connection: IConnectionProfile): Promise<void> {
if (this.ignoreNextConnect) {
this._connectionDialog.resetConnection();
@@ -275,6 +284,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
} else if (connectionResult && connectionResult.errorHandled) {
this._connectionDialog.resetConnection();
this._logService.debug(`ConnectionDialogService: Error handled and connection reset - Error: ${connectionResult.errorMessage}`);
} else if (connection.providerName === Constants.mssqlProviderName && connectionResult.errorCode === Constants.sqlPasswordErrorCode) {
this._connectionDialog.resetConnection();
this.launchChangePasswordDialog(connection, params);
} else {
this._connectionDialog.resetConnection();
this.showErrorDialog(Severity.Error, this._connectionErrorTitle, connectionResult.errorMessage, connectionResult.callStack, connectionResult.errorCode);
@@ -495,6 +507,12 @@ export class ConnectionDialogService implements IConnectionDialogService {
recentConnections.forEach(conn => conn.dispose());
}
public launchChangePasswordDialog(profile: IConnectionProfile, params: INewConnectionParams): void {
let dialog = this._instantiationService.createInstance(PasswordChangeDialog);
dialog.open(profile, params);
}
private showErrorDialog(severity: Severity, headerTitle: string, message: string, messageDetails?: string, errorCode?: number): void {
// Kerberos errors are currently very hard to understand, so adding handling of these to solve the common scenario
// note that ideally we would have an extensible service to handle errors by error code and provider, but for now