Skip to content

Commit

Permalink
Added switch dialog and adjust UI cancel logic for auth method and se…
Browse files Browse the repository at this point in the history
…tting

Signed-off-by: Sagar <sagargurung1001@gmail.com>
  • Loading branch information
SagarGi committed Nov 15, 2024
1 parent eac9443 commit 850ea4c
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
data-test-id="submit-oidc-auth-values-btn"
type="primary"
:disabled="isAuthenticationMethodAlreadySelected"
@click="saveOIDCAuthValues">
@click="chooseAuthenticationMethod">
<template #icon>
<NcLoadingIcon v-if="loadingAuthenticationMethodForm" class="loading-spinner" :size="20" />
<CheckBoldIcon v-else fill-color="#FFFFFF" :size="20" />
Expand Down Expand Up @@ -935,10 +935,12 @@ export default {
setAuthenticationMethodToViewMode() {
this.formMode.authenticationMethod = F_MODES.VIEW
this.isFormCompleted.authenticationMethod = true
this.authenticationMethod = this.authenticationMethodSelected
},
setAuthenticationSettingToViewMode() {
this.formMode.authenticationSetting = F_MODES.VIEW
this.isFormCompleted.authenticationSetting = true
this.state.authentication_settings.targeted_audience_client_id = this.authenticationSetting.currentTargetedAudienceClientIdSelected
},
setServerHostFormToEditMode() {
this.formMode.server = F_MODES.EDIT
Expand Down Expand Up @@ -1111,6 +1113,28 @@ export default {
true,
)
},
async chooseAuthenticationMethod() {
if (this.isAuthenticationFormInEditMode && this.authenticationMethodSelected !== null) {
await OC.dialogs.confirmDestructive(
t('integration_openproject', 'If you proceed, it will not delete or affect your current authentication method configuration. You can switch back to it anytime.'),
t('integration_openproject', 'Switch to OpenID identity provider'),
{
type: OC.dialogs.YES_NO_BUTTONS,
confirm: t('integration_openproject', 'Yes, reset'),
confirmClasses: 'error',
cancel: t('integration_openproject', 'Cancel'),
},
async (result) => {
if (result) {
await this.saveOIDCAuthValues()
}
},
true,
)
return ''
}
await this.saveOIDCAuthValues()
},
async clearOPOAuthClientValues() {
this.isFormStep = FORM.OP_OAUTH
this.formMode.opOauth = F_MODES.EDIT
Expand Down

0 comments on commit 850ea4c

Please sign in to comment.