mirror of https://github.com/portainer/portainer
fix(settings/oauth): show internal auth prompt by default [EE-4576] (#8481)
* fix(settings/oauth): show internal auth prompt by default [EE-4576] fix [EE-4576] * fix(oauth): use new confirm modalpull/8527/head
parent
86d0e30eb7
commit
2c247efd0f
|
@ -1,14 +1,18 @@
|
|||
import { baseHref } from '@/portainer/helpers/pathHelper';
|
||||
import { isLimitedToBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
||||
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
||||
import { isLimitedToBE } from '@/react/portainer/feature-flags/feature-flags.service';
|
||||
import { ModalType } from '@@/modals';
|
||||
import { confirm } from '@@/modals/confirm';
|
||||
import { buildConfirmButton } from '@@/modals/utils';
|
||||
|
||||
import providers, { getProviderByUrl } from './providers';
|
||||
|
||||
const MS_TENANT_ID_PLACEHOLDER = 'TENANT_ID';
|
||||
|
||||
export default class OAuthSettingsController {
|
||||
/* @ngInject */
|
||||
constructor($scope) {
|
||||
Object.assign(this, { $scope });
|
||||
constructor($scope, $async) {
|
||||
Object.assign(this, { $scope, $async });
|
||||
|
||||
this.limitedFeature = FeatureId.HIDE_INTERNAL_AUTH;
|
||||
this.limitedFeatureClass = 'limited-be';
|
||||
|
@ -69,15 +73,30 @@ export default class OAuthSettingsController {
|
|||
updateSSO(checked) {
|
||||
this.$scope.$evalAsync(() => {
|
||||
this.settings.SSO = checked;
|
||||
this.onChangeHideInternalAuth(checked);
|
||||
this.settings.HideInternalAuth = false;
|
||||
});
|
||||
}
|
||||
|
||||
onChangeHideInternalAuth(checked) {
|
||||
this.$scope.$evalAsync(() => {
|
||||
if (!this.isLimitedToBE) {
|
||||
this.settings.HideInternalAuth = checked;
|
||||
async onChangeHideInternalAuth(checked) {
|
||||
this.$async(async () => {
|
||||
if (this.isLimitedToBE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (checked) {
|
||||
const confirmed = await confirm({
|
||||
title: 'Hide internal authentication prompt',
|
||||
message: 'By hiding internal authentication prompt, you will only be able to login via SSO. Are you sure?',
|
||||
confirmButton: buildConfirmButton('Confirm', 'btn-warning'),
|
||||
modalType: ModalType.Warn,
|
||||
});
|
||||
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.settings.HideInternalAuth = checked;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue