You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by li...@apache.org on 2020/03/31 00:50:20 UTC
[submarine] branch master updated: SUBMARINE-444. [WORKBENCH] Login
error should be more graceful
This is an automated email from the ASF dual-hosted git repository.
liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 4a5f69d SUBMARINE-444. [WORKBENCH] Login error should be more graceful
4a5f69d is described below
commit 4a5f69d3efa2cb3ba1ae2924ef03c4d2a93e3efb
Author: Ryan Lo <lo...@gmail.com>
AuthorDate: Mon Mar 30 20:03:48 2020 +0800
SUBMARINE-444. [WORKBENCH] Login error should be more graceful
### What is this PR for?
Make login error message be more graceful
### What type of PR is it?
[Bug Fix]
### Todos
### What is the Jira issue?
[SUBMARINE-444](https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-444)
### How should this be tested?
[passed CI](https://travis-ci.org/github/lowc1012/submarine/builds/668670403)
### Screenshots (if appropriate)
<img width="1227" alt="screenshot1" src="https://user-images.githubusercontent.com/52355146/77903564-aa4c5e00-72b5-11ea-9fa0-00d0b90f3990.png">
<img width="875" alt="screenshot2" src="https://user-images.githubusercontent.com/52355146/77903650-c8b25980-72b5-11ea-98d4-85cc4c6cd772.png">
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Ryan Lo <lo...@gmail.com>
Author: RyanLo <52...@users.noreply.github.com>
Closes #254 from lowc1012/SUBMARINE-444 and squashes the following commits:
5c92c96 [RyanLo] Update submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/rest/LoginRestApi.java
4eec3e9 [Ryan Lo] SUBMARINE-444. [WORKBENCH] Login error should be more graceful
---
.../org/apache/submarine/server/workbench/rest/LoginRestApi.java | 7 +++++--
.../src/test/java/org/apache/submarine/integration/loginIT.java | 5 +++--
.../workbench-web-ng/src/app/pages/user/login/login.component.ts | 5 ++++-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/rest/LoginRestApi.java b/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/rest/LoginRestApi.java
index 0394115..9372410 100644
--- a/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/rest/LoginRestApi.java
+++ b/submarine-server/server-core/src/main/java/org/apache/submarine/server/workbench/rest/LoginRestApi.java
@@ -59,8 +59,11 @@ public class LoginRestApi {
try (SqlSession sqlSession = MyBatisUtil.getSqlSession()) {
SysUserMapper sysUserMapper = sqlSession.getMapper(SysUserMapper.class);
sysUser = sysUserMapper.login(mapParams);
-
- sysUser.setToken("mock_token");
+ if (sysUser != null) {
+ sysUser.setToken("mock_token");
+ } else {
+ LOG.info("User Not Found. Please try again");
+ }
} catch (Exception e) {
LOG.error(e.getMessage(), e);
return new JsonResponse.Builder<>(Response.Status.OK).success(false).build();
diff --git a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java
index e7809d2..de8a58a 100644
--- a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java
+++ b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/loginIT.java
@@ -55,9 +55,10 @@ public class loginIT extends AbstractSubmarineIT {
pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("123");
pollingWait(By.cssSelector("input[ng-reflect-name='password']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("123");
clickAndWait(By.cssSelector("button[class='login-form-button ant-btn ant-btn-primary']"));
- Assert.assertEquals( driver.findElements(By.xpath("//div[contains(text(), \"_this.logError is not a function\")]")).size(), 1);
+ Assert.assertEquals( driver.findElements(By.xpath("//div[contains(text(), \"Username and password are incorrect, " +
+ "please try again or create an account\")]")).size(), 1);
pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("\b\b\b");
- pollingWait(By.cssSelector("input[ng-reflect-name='password']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("\b\b\b");
+ pollingWait(By.cssSelector("input[ng-reflect-name='password']"), MAX_BROWSER_TIMEOUT_SEC).sendKeys("\b\b\b");
// Testcase2
LOG.info("[Sub-Testcase-2] Valid User");
diff --git a/submarine-workbench/workbench-web-ng/src/app/pages/user/login/login.component.ts b/submarine-workbench/workbench-web-ng/src/app/pages/user/login/login.component.ts
index 2158604..3f2f09b 100644
--- a/submarine-workbench/workbench-web-ng/src/app/pages/user/login/login.component.ts
+++ b/submarine-workbench/workbench-web-ng/src/app/pages/user/login/login.component.ts
@@ -74,7 +74,10 @@ export class LoginComponent implements OnInit {
}
requestFailed(error: Error) {
- this.nzNotificationService.error('Request error', error.message || 'Request error, please try again', {
+ this.nzNotificationService.error('Login Failed',
+ 'Username and password are incorrect, ' +
+ 'please try again or create an account',
+ {
nzDuration: 4000
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org