+- (void) webView:(WebView *)view resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)source {
+ challenge_ = [challenge retain];
+
+ NSURLProtectionSpace *space([challenge protectionSpace]);
+ NSString *realm([space realm]);
+ if (realm == nil)
+ realm = @"";
+
+ UIAlertView *alert = [[[UIAlertView alloc]
+ initWithTitle:realm
+ message:nil
+ delegate:self
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("LOGIN"), nil
+ ] autorelease];
+
+ [alert setContext:@"challenge"];
+ [alert setNumberOfRows:1];
+
+ [alert addTextFieldWithValue:@"" label:UCLocalize("USERNAME")];
+ [alert addTextFieldWithValue:@"" label:UCLocalize("PASSWORD")];
+
+ UITextField *username([alert textFieldAtIndex:0]); {
+ UITextInputTraits *traits([username textInputTraits]);
+ [traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
+ [traits setAutocorrectionType:UITextAutocorrectionTypeNo];
+ [traits setKeyboardType:UIKeyboardTypeASCIICapable];
+ [traits setReturnKeyType:UIReturnKeyNext];
+ }
+
+ UITextField *password([alert textFieldAtIndex:1]); {
+ UITextInputTraits *traits([password textInputTraits]);
+ [traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
+ [traits setAutocorrectionType:UITextAutocorrectionTypeNo];
+ [traits setKeyboardType:UIKeyboardTypeASCIICapable];
+ // XXX: UIReturnKeyDone
+ [traits setReturnKeyType:UIReturnKeyNext];
+ [traits setSecureTextEntry:YES];
+ }
+
+ [alert show];
+}
+