diff options
| author | Jonathan Bauer | 2015-07-08 11:54:43 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-07-08 11:54:43 +0200 |
| commit | bc649c98ab604c4c605f1054d602389a728cccc3 (patch) | |
| tree | 1cad42598c493bfa8843fa6d9fd4e28b15ccd332 | |
| parent | [client] authenticator for the direct masterserver login (diff) | |
| download | tutor-module-bc649c98ab604c4c605f1054d602389a728cccc3.tar.gz tutor-module-bc649c98ab604c4c605f1054d602389a728cccc3.tar.xz tutor-module-bc649c98ab604c4c605f1054d602389a728cccc3.zip | |
[client] user feedback when login fails.
Need to change TAuthorizationException received on failed login by a TAuthenticationException,
then we can actually do a proper handling of that error
| -rw-r--r-- | dozentenmodul/src/main/java/auth/BWLPAuthenticator.java | 6 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/gui/core/LoginGUI.java | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/dozentenmodul/src/main/java/auth/BWLPAuthenticator.java b/dozentenmodul/src/main/java/auth/BWLPAuthenticator.java index f619b453..66c31d73 100644 --- a/dozentenmodul/src/main/java/auth/BWLPAuthenticator.java +++ b/dozentenmodul/src/main/java/auth/BWLPAuthenticator.java @@ -4,6 +4,7 @@ import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.SessionData; import org.openslx.bwlp.thrift.iface.TAuthenticationException; +import org.openslx.bwlp.thrift.iface.TAuthorizationException; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.thrifthelper.ThriftManager; @@ -30,6 +31,8 @@ public class BWLPAuthenticator implements BaseAuthenticator { authResult = ThriftManager.getMasterClient().authenticate(username, password); } catch (TException e) { LOGGER.error("Thrift communication error: ", e); + // TODO authenticate has to return a TAuthenticationException! + callback.postLogin(ReturnCode.ERROR_OTHER, null); return; } @@ -40,6 +43,9 @@ public class BWLPAuthenticator implements BaseAuthenticator { userInfo = ThriftManager.getMasterClient().getUserFromToken(authResult.authToken); } catch (TException e) { LOGGER.error("Thrift communication error: ", e); + // TODO authenticate has to return a TAuthenticationException! + callback.postLogin(ReturnCode.ERROR_OTHER, null); + return; } callback.postLogin(ReturnCode.NO_ERROR, userInfo); } else { diff --git a/dozentenmodul/src/main/java/gui/core/LoginGUI.java b/dozentenmodul/src/main/java/gui/core/LoginGUI.java index 7718c0dd..e85f83cc 100644 --- a/dozentenmodul/src/main/java/gui/core/LoginGUI.java +++ b/dozentenmodul/src/main/java/gui/core/LoginGUI.java @@ -14,6 +14,7 @@ import org.eclipse.swt.widgets.Shell; import org.openslx.bwlp.dozmod.thrift.OrganizationCache; import org.openslx.bwlp.thrift.iface.Organization; import org.openslx.bwlp.thrift.iface.TAuthenticationException; +import org.openslx.bwlp.thrift.iface.TAuthorizationException; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.thrifthelper.ThriftManager; @@ -196,8 +197,11 @@ public class LoginGUI extends LoginComposite { public void postLogin(ReturnCode returnCode, UserInfo user) { // handle errors first if (returnCode != ReturnCode.NO_ERROR && user == null) { - GuiManager.showMessage("Internal error!"); - } else { + LOGGER.error("BWLP login failed."); + GuiManager.showMessage("Login failed!"); + } + if (returnCode == ReturnCode.NO_ERROR && user != null) { + LOGGER.error("BWLP login failed."); // TODO: FOR DEBUGGING/DEV PURPOSES! ThriftManager.setSatelliteAddress( "132.230.8.113" ); GuiManager.addContent(new DisclaimerComposite(getShell())); @@ -205,7 +209,7 @@ public class LoginGUI extends LoginComposite { } }); } catch (TAuthenticationException e) { - GuiManager.showMessage(BAD_AUTH); + GuiManager.showMessage(e.getMessage()); } break; case SAT: |
