Disable button on login to prevent multiple requests

This commit is contained in:
giomfo
2014-10-13 18:31:40 +02:00
parent 8cf3ce7d02
commit 1dfb582f5a

View File

@@ -66,7 +66,6 @@ NSString* const defaultHomeserver = @"http://matrix.org";
constant:0];
[self.view addConstraint:rightConstraint];
// Prefill text field
_userLoginTextField.text = [[MatrixHandler sharedHandler] userLogin];
_homeServerTextField.text = [[MatrixHandler sharedHandler] homeServerURL];
@@ -192,6 +191,8 @@ NSString* const defaultHomeserver = @"http://matrix.org";
if (matrix.mxHomeServer)
{
// Disable login button to prevent multiple requests
_loginBtn.enabled = NO;
[_activityIndicator startAnimating];
[matrix.mxHomeServer loginWithUser:matrix.userLogin andPassword:_passWordTextField.text
@@ -207,6 +208,7 @@ NSString* const defaultHomeserver = @"http://matrix.org";
}
failure:^(NSError *error){
[_activityIndicator stopAnimating];
_loginBtn.enabled = YES;
NSLog(@"Login failed: %@", error);
//Alert user