[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1869: If the user gives a bad password, prompt them to enter a new (in trunk: . src/gui)
Author: edmanm
Date: 2007-08-24 22:28:42 -0400 (Fri, 24 Aug 2007)
New Revision: 1869
Modified:
trunk/
trunk/src/gui/mainwindow.cpp
Log:
r2060@adrastea: edmanm | 2007-08-24 22:28:35 -0400
If the user gives a bad password, prompt them to enter a new one and then
retry. (This involves icky error message parsing.) If we don't recognize the
error, display the error message and give the user the option of going
directly to their control port authentication settings.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /vidalia/local/trunk [r2060] on 54b3572a-7227-0410-958f-53ecd705b71a
Modified: trunk/src/gui/mainwindow.cpp
===================================================================
--- trunk/src/gui/mainwindow.cpp 2007-08-25 01:03:16 UTC (rev 1868)
+++ trunk/src/gui/mainwindow.cpp 2007-08-25 02:28:42 UTC (rev 1869)
@@ -816,17 +816,41 @@
void
MainWindow::authenticationFailed(QString errmsg)
{
- /*XXX This should be smarter. We should parse the error message and give a
- * more helpful hint about what went wrong. */
- VMessageBox::warning(this,
- tr("Error Authenticating to Tor"),
- p(tr("Vidalia was unable to authenticate to Tor.")) + p(errmsg),
- VMessageBox::Ok);
-
+ bool retry = false;
+
+ /* Parsing log messages is evil, but we're left with little option */
+ if (errmsg.contains("Password did not match")) {
+ /* Bad password, so prompt for a new one. */
+ QString password = QInputDialog::getText(this,
+ tr("Password Authentication Required"),
+ tr("Please enter your control password:"),
+ QLineEdit::Password);
+ if (!password.isEmpty()) {
+ TorSettings settings;
+ settings.setAuthenticationMethod(TorSettings::PasswordAuth);
+ settings.setControlPassword(password);
+ retry = true;
+ }
+ } else {
+ /* Something else went wrong */
+ int ret = VMessageBox::warning(this,
+ tr("Error Authenticating to Tor"),
+ p(tr("Vidalia was unable to authenticate to Tor. "
+ "(%1)").arg(errmsg)) +
+ p(tr("Please check your control port authentication "
+ "settings.")),
+ VMessageBox::ShowSettings, VMessageBox::Cancel);
+
+ if (ret == VMessageBox::ShowSettings)
+ showConfigDialog(ConfigDialog::Advanced);
+ }
+
if (_torControl->isRunning() && _isVidaliaRunningTor)
stop();
else if (_torControl->isConnected())
disconnect();
+ if (retry)
+ start();
}
/** Searches for and attempts to load the control authentication cookie. This