Refactored post login logic in login controller
This commit is contained in:
parent
b7a24e6ca0
commit
748693a3a4
@ -72,7 +72,7 @@ class LoginController @Inject() (
|
||||
val inputPassword = passwordTextField.text()
|
||||
|
||||
submitButton.disable = true
|
||||
login(inputUserName, inputPassword) onComplete {
|
||||
login(inputUserName, inputPassword) andThen {
|
||||
case Success(maybeToken) => {
|
||||
maybeToken match {
|
||||
case Some(token) =>
|
||||
@ -82,12 +82,10 @@ class LoginController @Inject() (
|
||||
appDataHandler.updateCredentials(credentials)
|
||||
updateErrorLabel("")
|
||||
applicationController.showChatPane()
|
||||
onFX { submitButton.disable = false }
|
||||
}
|
||||
case None => {
|
||||
updateErrorLabel("Error logging in - please check your password")
|
||||
logger.warn("Login unsuccessful wrong password")
|
||||
onFX { submitButton.disable = false }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,9 +93,11 @@ class LoginController @Inject() (
|
||||
logger.error(s"${exception.getMessage()}")
|
||||
logger.warn("Login unsuccessful network problem")
|
||||
updateErrorLabel("Error logging in - Please check your network")
|
||||
onFX { submitButton.disable = false }
|
||||
}
|
||||
} andThen {
|
||||
case _ => { onFX { submitButton.disable = false } }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def updateErrorLabel(message: String) = onFX {
|
||||
|
Loading…
Reference in New Issue
Block a user