* Handle authentication challenges by sending them off to the WebViewWindow
which then invokes the authenticationChallenge() hook. * Implemented that hook in LauncherWindow by means of the AuthenticationPanel. * Removed realm and method arguments to AuthenticationPanel::getAuthentication() and replaced them by a simple "text" that is constructed in the FrameLoaderClient based on the challenge details. It is not yet shown though. * Made a tab -> spaces replace and added myself to the copyrights in some files. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@74 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
@@ -112,17 +112,12 @@ AuthenticationPanel::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthenticationPanel::getAuthentication(const BString& realm,
|
bool AuthenticationPanel::getAuthentication(const BString& text,
|
||||||
const BString& method, const BString& previousUser, const BString& previousPass,
|
const BString& previousUser, const BString& previousPass,
|
||||||
bool previousRememberCredentials, bool badPassword,
|
bool previousRememberCredentials, bool badPassword,
|
||||||
BString& user, BString& pass, bool* rememberCredentials)
|
BString& user, BString& pass, bool* rememberCredentials)
|
||||||
{
|
{
|
||||||
// Configure panel and layout controls.
|
// Configure panel and layout controls.
|
||||||
BString infoText("Enter login information for: ");
|
|
||||||
infoText << realm << "\n\n";
|
|
||||||
infoText << "Authentication method: ";
|
|
||||||
infoText << method;
|
|
||||||
|
|
||||||
m_usernameTextControl->SetText(previousUser.String());
|
m_usernameTextControl->SetText(previousUser.String());
|
||||||
m_passwordTextControl->TextView()->HideTyping(true);
|
m_passwordTextControl->TextView()->HideTyping(true);
|
||||||
// Ignore the previous password, if it didn't work.
|
// Ignore the previous password, if it didn't work.
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
bool getAuthentication(const BString& realm, const BString& method,
|
bool getAuthentication(const BString& text, const BString& previousUser,
|
||||||
const BString& previousUser, const BString& previousPass,
|
const BString& previousPass, bool previousRememberCredentials,
|
||||||
bool previousRememberCredentials, bool badPassword, BString& user,
|
bool badPassword, BString& user, BString& pass,
|
||||||
BString& pass, bool* rememberCredentials);
|
bool* rememberCredentials);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BRect m_parentWindowFrame;
|
BRect m_parentWindowFrame;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2007 Ryan Leavengood <[email protected]>
|
* Copyright (C) 2007 Ryan Leavengood <[email protected]>
|
||||||
* Copyright (C) 2009 Maxime Simon <[email protected]>
|
* Copyright (C) 2009 Maxime Simon <[email protected]>
|
||||||
* Copyright (C) 2010 Stephan Aßmus <[email protected]>
|
* Copyright (C) 2010 Stephan Aßmus <[email protected]>
|
||||||
|
* Copyright (C) 2010 Michael Lotz <[email protected]>
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -262,23 +263,6 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
|||||||
be_app->PostMessage(message);
|
be_app->PostMessage(message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TEST_AUTHENTICATION_PANEL: {
|
|
||||||
BString realm("Realm");
|
|
||||||
BString method("Method");
|
|
||||||
BString previousUser;
|
|
||||||
BString previousPass;
|
|
||||||
bool rememberCredentials = false;
|
|
||||||
bool badPassword = true;
|
|
||||||
BString user;
|
|
||||||
BString pass;
|
|
||||||
AuthenticationPanel* panel = new AuthenticationPanel(Frame());
|
|
||||||
bool success = panel->getAuthentication(realm, method, previousUser,
|
|
||||||
previousPass, rememberCredentials, badPassword, user, pass,
|
|
||||||
&rememberCredentials);
|
|
||||||
printf("success: %d\n", success);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WebViewWindow::MessageReceived(message);
|
WebViewWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -383,3 +367,30 @@ void LauncherWindow::navigationCapabilitiesChanged(bool canGoBackward,
|
|||||||
if (m_ForwardButton)
|
if (m_ForwardButton)
|
||||||
m_ForwardButton->SetEnabled(canGoForward);
|
m_ForwardButton->SetEnabled(canGoForward);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LauncherWindow::authenticationChallenge(BMessage* message)
|
||||||
|
{
|
||||||
|
BString text;
|
||||||
|
bool rememberCredentials = false;
|
||||||
|
uint32 failureCount = 0;
|
||||||
|
BString user;
|
||||||
|
BString password;
|
||||||
|
|
||||||
|
message->FindString("text", &text);
|
||||||
|
message->FindString("user", &user);
|
||||||
|
message->FindString("password", &password);
|
||||||
|
message->FindUInt32("failureCount", &failureCount);
|
||||||
|
|
||||||
|
AuthenticationPanel* panel = new AuthenticationPanel(Frame());
|
||||||
|
if (!panel->getAuthentication(text, user, password, rememberCredentials,
|
||||||
|
failureCount > 0, user, password, &rememberCredentials)) {
|
||||||
|
message->SendReply((uint32)0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BMessage reply;
|
||||||
|
reply.AddString("user", user);
|
||||||
|
reply.AddString("password", password);
|
||||||
|
reply.AddBool("rememberCredentials", rememberCredentials);
|
||||||
|
message->SendReply(&reply);
|
||||||
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public:
|
|||||||
virtual void statusChanged(const BString& status);
|
virtual void statusChanged(const BString& status);
|
||||||
virtual void navigationCapabilitiesChanged(bool canGoBackward,
|
virtual void navigationCapabilitiesChanged(bool canGoBackward,
|
||||||
bool canGoForward, bool canStop);
|
bool canGoForward, bool canStop);
|
||||||
|
virtual void authenticationChallenge(BMessage* challenge);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMenuBar* m_menuBar;
|
BMenuBar* m_menuBar;
|
||||||
|
|||||||
Reference in New Issue
Block a user