fix auth-viewcontroller unusable after failed authentication

This commit is contained in:
Stephan Diederich 2013-09-10 23:57:00 +02:00
parent 34bf1bf611
commit 1938e480cc
2 changed files with 13 additions and 8 deletions

View File

@ -294,8 +294,8 @@
}
- (void) setLoginUIEnabled:(BOOL) enabled {
self.navigationItem.rightBarButtonItem.enabled = !enabled;
self.tableView.userInteractionEnabled = !enabled;
self.navigationItem.rightBarButtonItem.enabled = enabled;
self.tableView.userInteractionEnabled = enabled;
}
@end

View File

@ -300,13 +300,18 @@ static NSString* const kBITAuthenticatorDidSkipOptionalLogin = @"BITAuthenticato
NSError *authParseError = nil;
NSString *authToken = [strongSelf.class authenticationTokenFromReponse:response
error:&authParseError];
NSError *error = nil;
if(nil == authToken) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Failed to authenticate"
delegate:nil
cancelButtonTitle:BITHockeyLocalizedString(@"OK")
otherButtonTitles:nil];
[alert show];
if([authParseError.domain isEqualToString:kBITAuthenticatorErrorDomain] &&
authParseError.code == BITAuthenticatorNotAuthorized) {
error = [NSError errorWithDomain:kBITAuthenticatorErrorDomain
code:BITAuthenticatorNotAuthorized
userInfo:@{
//TODO localize
NSLocalizedDescriptionKey : @"Not authorized",
NSUnderlyingErrorKey : authParseError
}];
}
completion(NO, error);
} else {
//no need to call completion, we're dismissing it anyways