mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
use original error message for CORS/offline state in login (#1790)
* use original error message for CORS/offline state in login * fix tests
This commit is contained in:
parent
2651ec46d6
commit
5a692f28f5
@ -294,7 +294,7 @@ describe('AlfrescoLogin', () => {
|
|||||||
expect(component.error).toBe(true);
|
expect(component.error).toBe(true);
|
||||||
expect(component.success).toBe(false);
|
expect(component.success).toBe(false);
|
||||||
expect(element.querySelector('#login-error')).toBeDefined();
|
expect(element.querySelector('#login-error')).toBeDefined();
|
||||||
expect(element.querySelector('#login-error').innerText).toEqual('LOGIN.MESSAGES.LOGIN-ERROR-CORS');
|
expect(element.querySelector('#login-error').innerText).toEqual('ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return CSRF error when server CSRF error occurs', () => {
|
it('should return CSRF error when server CSRF error occurs', () => {
|
||||||
|
@ -179,9 +179,8 @@ export class AlfrescoLoginComponent implements OnInit {
|
|||||||
* Check and display the right error message in the UI
|
* Check and display the right error message in the UI
|
||||||
*/
|
*/
|
||||||
private displayErrorMessage(err: any): void {
|
private displayErrorMessage(err: any): void {
|
||||||
if (err.error && err.error.crossDomain && err.error.message.indexOf('the network is offline, Origin is not allowed by' +
|
if (err.error && err.error.crossDomain && err.error.message.indexOf('Access-Control-Allow-Origin') !== -1) {
|
||||||
' Access-Control-Allow-Origin') !== -1) {
|
this.errorMsg = err.error.message;
|
||||||
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-CORS';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user