fix login error
This commit is contained in:
parent
baee52a69a
commit
e0ba0a9277
2 changed files with 9 additions and 13 deletions
|
@ -88,9 +88,6 @@ public class LoginPage implements TemplateComposer {
|
||||||
final Text loginPassword = this.widgetFactory.passwordInput(loginGroup);
|
final Text loginPassword = this.widgetFactory.passwordInput(loginGroup);
|
||||||
loginPassword.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
|
loginPassword.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
|
||||||
|
|
||||||
final SEBServerAuthorizationContext authorizationContext = this.authorizationContextHolder
|
|
||||||
.getAuthorizationContext(RWT.getUISession().getHttpSession());
|
|
||||||
|
|
||||||
final Composite buttons = new Composite(loginGroup, SWT.NONE);
|
final Composite buttons = new Composite(loginGroup, SWT.NONE);
|
||||||
buttons.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
|
buttons.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
|
||||||
buttons.setLayout(new GridLayout(2, false));
|
buttons.setLayout(new GridLayout(2, false));
|
||||||
|
@ -103,16 +100,14 @@ public class LoginPage implements TemplateComposer {
|
||||||
loginButton.addListener(SWT.Selection, event -> login(
|
loginButton.addListener(SWT.Selection, event -> login(
|
||||||
pageContext,
|
pageContext,
|
||||||
loginName.getText(),
|
loginName.getText(),
|
||||||
loginPassword.getText(),
|
loginPassword.getText()));
|
||||||
authorizationContext));
|
|
||||||
loginName.addListener(SWT.KeyDown, event -> {
|
loginName.addListener(SWT.KeyDown, event -> {
|
||||||
if (event.character == '\n' || event.character == '\r') {
|
if (event.character == '\n' || event.character == '\r') {
|
||||||
if (StringUtils.isNotBlank(loginPassword.getText())) {
|
if (StringUtils.isNotBlank(loginPassword.getText())) {
|
||||||
login(
|
login(
|
||||||
pageContext,
|
pageContext,
|
||||||
loginName.getText(),
|
loginName.getText(),
|
||||||
loginPassword.getText(),
|
loginPassword.getText());
|
||||||
authorizationContext);
|
|
||||||
} else {
|
} else {
|
||||||
loginPassword.setFocus();
|
loginPassword.setFocus();
|
||||||
}
|
}
|
||||||
|
@ -124,8 +119,7 @@ public class LoginPage implements TemplateComposer {
|
||||||
login(
|
login(
|
||||||
pageContext,
|
pageContext,
|
||||||
loginName.getText(),
|
loginName.getText(),
|
||||||
loginPassword.getText(),
|
loginPassword.getText());
|
||||||
authorizationContext);
|
|
||||||
} else {
|
} else {
|
||||||
loginName.setFocus();
|
loginName.setFocus();
|
||||||
}
|
}
|
||||||
|
@ -144,11 +138,13 @@ public class LoginPage implements TemplateComposer {
|
||||||
private void login(
|
private void login(
|
||||||
final PageContext pageContext,
|
final PageContext pageContext,
|
||||||
final String loginName,
|
final String loginName,
|
||||||
final CharSequence loginPassword,
|
final CharSequence loginPassword) {
|
||||||
final SEBServerAuthorizationContext authorizationContext) {
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
final SEBServerAuthorizationContext authorizationContext = this.authorizationContextHolder
|
||||||
|
.getAuthorizationContext();
|
||||||
|
|
||||||
final boolean loggedIn = authorizationContext.login(
|
final boolean loggedIn = authorizationContext.login(
|
||||||
loginName,
|
loginName,
|
||||||
loginPassword);
|
loginPassword);
|
||||||
|
@ -172,6 +168,8 @@ public class LoginPage implements TemplateComposer {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
loginError(pageContext, "sebserver.login.failed.message");
|
loginError(pageContext, "sebserver.login.failed.message");
|
||||||
|
// disable user authorization
|
||||||
|
this.authorizationContextHolder.getAuthorizationContext();
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
log.error("Unexpected error while trying to login with user: {}", loginName, e);
|
log.error("Unexpected error while trying to login with user: {}", loginName, e);
|
||||||
|
|
|
@ -374,8 +374,6 @@ public class PageServiceImpl implements PageService {
|
||||||
|
|
||||||
if (!logoutSuccessful) {
|
if (!logoutSuccessful) {
|
||||||
log.warn("Failed to logout. See log-files for more information");
|
log.warn("Failed to logout. See log-files for more information");
|
||||||
pageContext.forwardToMainPage();
|
|
||||||
pageContext.publishInfo(new LocTextKey("sebserver.error.logout"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue