File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ export default class DaTitle extends LitElement {
147
147
</ div >
148
148
< div class ="da-title-collab-actions-wrapper ">
149
149
${ this . collabStatus ? this . renderCollab ( ) : nothing }
150
- ${ this . _status ? html `< p class ="da-title-error-details "> ${ this . _status . message } ${ this . _status . action } . ( ${ this . _status . status } ) </ p > ` : nothing }
150
+ ${ this . _status ? html `< p class ="da-title-error-details "> ${ this . _status . message } ${ this . _status . action } .</ p > ` : nothing }
151
151
< div class ="da-title-actions ${ this . _actionsVis ? ' is-open' : '' } ">
152
152
${ this . details . view === 'config' ? this . renderSave ( ) : this . renderAemActions ( ) }
153
153
< button
Original file line number Diff line number Diff line change @@ -98,11 +98,13 @@ export async function saveToAem(path, action) {
98
98
const resp = await daFetch ( url , { method : 'POST' } ) ;
99
99
// eslint-disable-next-line no-console
100
100
if ( ! resp . ok ) {
101
+ const { status } = resp ;
102
+ const message = [ 401 , 403 ] . some ( ( s ) => s === status ) ? 'Not authorized to' : 'Error during' ;
101
103
return {
102
104
error : {
103
- status : resp . status ,
105
+ status,
104
106
type : 'error' ,
105
- message : 'Error during' ,
107
+ message,
106
108
} ,
107
109
} ;
108
110
}
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ import { DA_ORIGIN } from './constants.js';
2
2
3
3
const { getNx } = await import ( '../../scripts/utils.js' ) ;
4
4
5
- const ALLOWED_TOKEN = [ 'https://admin.hlx.page' , 'https://admin.da.live' , 'https://stage-admin.da.live' ] ;
5
+ const DA_ORIGINS = [ 'https://admin.da.live' , 'https://stage-admin.da.live' ] ;
6
+ const AEM_ORIGINS = [ 'https://admin.hlx.page' , 'https://admin.aem.live' ] ;
7
+ const ALLOWED_TOKEN = [ ...DA_ORIGINS , ...AEM_ORIGINS ] ;
6
8
7
9
let imsDetails ;
8
10
@@ -28,14 +30,16 @@ export const daFetch = async (url, opts = {}) => {
28
30
}
29
31
const resp = await fetch ( url , opts ) ;
30
32
if ( resp . status === 401 ) {
31
- if ( accessToken ) {
32
- window . location = `${ window . location . origin } /not-found` ;
33
- return { ok : false } ;
33
+ // Only attempt sign-in if the request is for DA.
34
+ if ( DA_ORIGINS . some ( ( origin ) => url . startsWith ( origin ) ) ) {
35
+ if ( accessToken ) {
36
+ window . location = `${ window . location . origin } /not-found` ;
37
+ return { ok : false } ;
38
+ }
39
+ const { loadIms, handleSignIn } = await import ( `${ getNx ( ) } /utils/ims.js` ) ;
40
+ await loadIms ( ) ;
41
+ handleSignIn ( ) ;
34
42
}
35
-
36
- const { loadIms, handleSignIn } = await import ( `${ getNx ( ) } /utils/ims.js` ) ;
37
- await loadIms ( ) ;
38
- handleSignIn ( ) ;
39
43
}
40
44
return resp ;
41
45
} ;
You can’t perform that action at this time.
0 commit comments