Skip to content

Commit e176310

Browse files
Mattia Vianellivins01-4science
authored andcommitted
Merged in task/dspace-cris-2024_02_x/DSC-2485 (pull request DSpace#3509)
DSC-2485 Fixed issue with login not working as expected (backdoor and external login broken) Approved-by: Francesco Molinaro
2 parents cba6c51 + ddbb7c6 commit e176310

4 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/app/app-routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,14 @@ export const APP_ROUTES: Route[] = [
187187
data: {
188188
isBackDoor: true,
189189
},
190-
canMatch: [() => environment.auth.disableStandardLogin],
190+
canMatch: [() => !environment.auth.disableStandardLogin],
191191
},
192192
{
193193
path: 'login',
194194
loadChildren: () => import('./login-page/login-page-routes').then((m) => m.ROUTES),
195195
data: {
196196
isBackDoor: false,
197197
},
198-
canMatch: [() => !environment.auth.disableStandardLogin],
199198
},
200199
{
201200
path: 'logout',

src/app/shared/log-in/log-in.component.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('LogInComponent', () => {
138138

139139
it('should render a log-in container component for each auth method available', () => {
140140
const loginContainers = fixture.debugElement.queryAll(By.css('ds-log-in-container'));
141-
expect(loginContainers.length).toBe(2);
141+
expect(loginContainers.length).toBe(1);
142142

143143
});
144144

@@ -154,14 +154,15 @@ describe('LogInComponent', () => {
154154
expect(result).toEqual([{ authMethodType: AuthMethodType.Password, position: 1 }]);
155155
});
156156

157-
it('excludes password method when standard login is disabled', () => {
157+
it('does not exclude password method when standard login is disabled', () => {
158158
const authMethods = [
159159
{ authMethodType: AuthMethodType.Password, position: 1 },
160160
{ authMethodType: AuthMethodType.Shibboleth, position: 2 },
161161
];
162162
component.excludedAuthMethod = undefined;
163163
const result = component.filterAndSortAuthMethods(authMethods, false, true);
164164
expect(result).toEqual([
165+
{ authMethodType: AuthMethodType.Password, position: 1 },
165166
{ authMethodType: AuthMethodType.Shibboleth, position: 2 },
166167
]);
167168
});
@@ -176,7 +177,6 @@ describe('LogInComponent', () => {
176177
component.excludedAuthMethod = AuthMethodType.Ip;
177178
const result = component.filterAndSortAuthMethods(authMethods, isBackdoor);
178179
expect(result).toEqual([
179-
{ authMethodType: AuthMethodType.Password, position: 1 },
180180
{ authMethodType: AuthMethodType.Shibboleth, position: 3 },
181181
]);
182182
});
@@ -191,7 +191,6 @@ describe('LogInComponent', () => {
191191
const result = component.filterAndSortAuthMethods(authMethods, isBackdoor);
192192
expect(result).toEqual([
193193
{ authMethodType: AuthMethodType.Shibboleth, position: 1 },
194-
{ authMethodType: AuthMethodType.Password, position: 2 },
195194
]);
196195
});
197196
});

src/app/shared/log-in/log-in.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export class LogInComponent implements OnInit, OnDestroy {
167167
if (isBackdoor) {
168168
return authM.authMethodType === AuthMethodType.Password;
169169
}
170-
if (isStandardLoginDisabled) {
170+
if (!isStandardLoginDisabled) {
171171
return authM.authMethodType !== AuthMethodType.Password;
172172
}
173173
return true;

src/config/default-app-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class DefaultAppConfig implements AppConfig {
147147
// This is independent from the idle warning.
148148
timeLeftBeforeTokenRefresh: 2 * 60 * 1000, // 2 minutes
149149
},
150-
disableStandardLogin: false, // Enable the standard login form
150+
disableStandardLogin: true, // Enable the standard login form
151151
};
152152

153153
// Form settings

0 commit comments

Comments
 (0)