You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2018/05/23 11:10:51 UTC
[ambari] 02/02: [AMBARI-23897] Log Search UI: login with invalid password – no error message is displayed
This is an automated email from the ASF dual-hosted git repository.
ababiichuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
commit abb5295f4ae0f1b0f98f4078dfb7bec9718986f6
Author: Tobias Istvan <to...@gmail.com>
AuthorDate: Wed May 23 09:31:46 2018 +0200
[AMBARI-23897] Log Search UI: login with invalid password – no error message is displayed
---
.../src/app/components/login-form/login-form.component.html | 2 +-
.../src/app/components/login-form/login-form.component.ts | 5 +----
.../ambari-logsearch-web/src/app/services/auth.service.ts | 4 ++--
.../ambari-logsearch-web/src/app/services/http-client.service.ts | 2 +-
ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json | 8 +++-----
5 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
index 9e8b2a5..3db75c6 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
@@ -16,7 +16,7 @@
-->
<div class="login-form well col-md-4 col-md-offset-4 col-sm-offset-4">
- <div class="alert alert-danger" *ngIf="isLoginAlertDisplayed" [innerHTML]="errorMessage"></div>
+ <div class="alert alert-danger" *ngIf="isLoginAlertDisplayed">{{errorMessage}}</div>
<form #loginForm="ngForm" (ngSubmit)="login()">
<div class="form-group">
<label for="username">{{'authorization.name' | translate}}</label>
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
index eee0b1b..d38fe33 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
@@ -76,10 +76,7 @@ export class LoginFormComponent implements OnInit, OnDestroy {
}
private onLoginError = (resp: Boolean): void => {
- Observable.combineLatest(
- this.translateService.get('login.error.title'),
- this.translateService.get('login.error.message')
- ).first().subscribe(([title, message]: [string, string]) => {
+ this.translateService.get('authorization.error.401').first().subscribe((message: string) => {
this.errorMessage = message;
this.isLoginAlertDisplayed = true;
});
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
index a3ed9b8..b78a88b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
@@ -81,7 +81,7 @@ export class AuthService {
const response$ = this.httpClient.postFormData('login', {
username: username,
password: password
- }).share();
+ });
response$.subscribe(
(resp: Response) => this.onLoginResponse(resp),
(resp: Response) => this.onLoginError(resp)
@@ -103,7 +103,7 @@ export class AuthService {
* @returns {Observable<boolean | Error>}
*/
logout(): Observable<Boolean> {
- const response$ = this.httpClient.get('logout').share();
+ const response$ = this.httpClient.get('logout');
response$.subscribe(
(resp: Response) => this.onLogoutResponse(resp),
(resp: Response) => this.onLogoutError(resp)
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
index 19a12ab..c65278b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
@@ -171,7 +171,7 @@ export class HttpClientService extends Http {
}
return handled;
};
- return super.request(this.generateUrl(url), options).first()
+ return super.request(this.generateUrl(url), options).first().share()
.map(response => response)
.catch((error: any) => {
return handleResponseError(error) ? Observable.of(error) : Observable.throw(error);
diff --git a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
index fec6991..ad69e1b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -24,7 +24,9 @@
"authorization.name": "Username",
"authorization.password": "Password",
"authorization.signIn": "Sign In",
- "authorization.error": "<strong>Error!</strong> Invalid User credentials.<br>Please try again.",
+ "authorization.error.401": "Unable to sign in. Invalid username/password combination.",
+
+ "login.title": "Login",
"topMenu.undo": "Undo",
"topMenu.redo": "Redo",
@@ -218,10 +220,6 @@
"logIndexFilter.update.success": "Log Index Filter for cluster <span class='cluster-name'>{{cluster}}</span> has been successfully updated.",
"logIndexFilter.update.error": "Error at updating Log Index Filter for cluster <span class='cluster-name'>{{cluster}}</span>. {{message}}",
- "login.title": "Login",
- "login.error.title": "Login error",
- "login.error.message": "Unable to sign in. Invalid username/password combination.",
-
"shipperConfiguration.title": "All Configuration",
"shipperConfiguration.add": "Add",
"shipperConfiguration.edit": "Edit",
--
To stop receiving notification emails like this one, please contact
ababiichuk@apache.org.