You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pd...@apache.org on 2020/09/28 14:37:35 UTC

[zeppelin] branch branch-0.9 updated: [ZEPPELIN-5068] Angular username and password encoding

This is an automated email from the ASF dual-hosted git repository.

pdallig pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new 7899adc  [ZEPPELIN-5068] Angular username and password encoding
7899adc is described below

commit 7899adce8cbddb84b00ac2b1da9ab14cad5d044e
Author: Philipp Dallig <ph...@gmail.com>
AuthorDate: Thu Sep 24 09:55:43 2020 +0200

    [ZEPPELIN-5068] Angular username and password encoding
    
    ### What is this PR for?
    This PR encodes username and password. `Content-Type: application/x-www-form-urlencoded` is set automatically.
    I also found a small typo and corrected the spelling of Notebook.
    
    ### What type of PR is it?
     - Bug Fix
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5068
    
    ### How should this be tested?
    * Travis-CI: https://travis-ci.org/github/Reamer/zeppelin/builds/729873263
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Philipp Dallig <ph...@gmail.com>
    
    Closes #3923 from Reamer/angular_username_and_password_encoding and squashes the following commits:
    
    1ac7170dc [Philipp Dallig] Correct spelling for Notebook
    dd2f0193f [Philipp Dallig] Encode username and password
    
    (cherry picked from commit 2e69f712329ff0ce1af964df08c89328f0be84aa)
    Signed-off-by: Philipp Dallig <ph...@gmail.com>
---
 .../src/app/services/ticket.service.ts             | 29 ++++++++++------------
 .../src/app/share/header/header.component.html     |  2 +-
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/zeppelin-web-angular/src/app/services/ticket.service.ts b/zeppelin-web-angular/src/app/services/ticket.service.ts
index a23bc0d..e0fd29a 100644
--- a/zeppelin-web-angular/src/app/services/ticket.service.ts
+++ b/zeppelin-web-angular/src/app/services/ticket.service.ts
@@ -10,7 +10,7 @@
  * limitations under the License.
  */
 
-import { HttpClient } from '@angular/common/http';
+import { HttpClient, HttpParams } from '@angular/common/http';
 import { Injectable } from '@angular/core';
 import { Router } from '@angular/router';
 import { forkJoin, BehaviorSubject, Subject } from 'rxjs';
@@ -84,21 +84,18 @@ export class TicketService {
   }
 
   login(userName: string, password: string) {
-    return this.httpClient
-      .post<ITicket>(`${this.baseUrlService.getRestApiBase()}/login`, `password=${password}&userName=${userName}`, {
-        headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
-      })
-      .pipe(
-        tap(
-          data => {
-            this.nzMessageService.success('Login Success');
-            this.setTicket(data);
-          },
-          () => {
-            this.nzMessageService.warning("The username and password that you entered don't match.");
-          }
-        )
-      );
+    const payload = new HttpParams().set('userName', userName).set('password', password);
+    return this.httpClient.post<ITicket>(`${this.baseUrlService.getRestApiBase()}/login`, payload).pipe(
+      tap(
+        data => {
+          this.nzMessageService.success('Login Success');
+          this.setTicket(data);
+        },
+        () => {
+          this.nzMessageService.warning("The username and password that you entered don't match.");
+        }
+      )
+    );
   }
 
   getZeppelinVersion() {
diff --git a/zeppelin-web-angular/src/app/share/header/header.component.html b/zeppelin-web-angular/src/app/share/header/header.component.html
index 76f93c2..2b9133f 100644
--- a/zeppelin-web-angular/src/app/share/header/header.component.html
+++ b/zeppelin-web-angular/src/app/share/header/header.component.html
@@ -20,7 +20,7 @@
   <div class="nav">
     <ul nz-menu [nzMode]="'horizontal'">
       <li nz-menu-item [class.ant-menu-item-selected]="noteListVisible">
-        <a nz-dropdown class="node-list-trigger" [nzDropdownMenu]="list" [nzTrigger]="'click'" [(nzVisible)]="noteListVisible">NoteBook
+        <a nz-dropdown class="node-list-trigger" [nzDropdownMenu]="list" [nzTrigger]="'click'" [(nzVisible)]="noteListVisible">Notebook
           <i class="small-icon" nz-icon nzType="caret-down"></i>
         </a>
         <nz-dropdown-menu #list="nzDropdownMenu">