vlog.info("%s", e.str());
disconnect();
} catch (rfb::AuthFailureException& e) {
+ reset_password_data();
vlog.error(_("Authentication failed: %s"), e.str());
abort_connection(_("Failed to authenticate with the server. Reason "
"given by the server:\n\n%s"), e.str());
#include <FL/Fl_Input.H>
#include <FL/Fl_Secret_Input.H>
#include <FL/Fl_Button.H>
+#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Pixmap.H>
{
}
+void UserDialog::resetPassword()
+{
+ savedUsername.clear();
+ savedPassword.clear();
+}
+
void UserDialog::getUserPasswd(bool secure_, std::string* user,
std::string* password)
{
return;
}
+ if (user && !savedUsername.empty() && !savedPassword.empty()) {
+ *user = savedUsername;
+ *password = savedPassword;
+ return;
+ }
+
+ if (!user && !savedPassword.empty()) {
+ *password = savedPassword;
+ return;
+ }
+
if (!user && passwordFileName[0]) {
std::vector<uint8_t> obfPwd(256);
FILE* fp;
Fl_Secret_Input *passwd;
Fl_Box *icon;
Fl_Button *button;
+ Fl_Check_Button *keepPasswdCheckbox;
int x, y;
passwd->align(FL_ALIGN_LEFT | FL_ALIGN_TOP);
y += INPUT_HEIGHT + INNER_MARGIN;
+ if (reconnectOnError) {
+ keepPasswdCheckbox = new Fl_Check_Button(LBLRIGHT(x, y,
+ CHECK_MIN_WIDTH,
+ CHECK_HEIGHT,
+ _("Keep password for reconnect")));
+ y += CHECK_HEIGHT + INNER_MARGIN;
+ } else {
+ keepPasswdCheckbox = nullptr;
+ }
+
x = win->w() - OUTER_MARGIN;
y += OUTER_MARGIN - INNER_MARGIN;
while (win->shown()) Fl::wait();
if (ret_val == 0) {
- if (user)
+ bool keepPasswd;
+
+ if (reconnectOnError)
+ keepPasswd = keepPasswdCheckbox->value();
+ else
+ keepPasswd = false;
+
+ if (user) {
*user = username->value();
+ if (keepPasswd)
+ savedUsername = username->value();
+ }
*password = passwd->value();
+ if (keepPasswd)
+ savedPassword = passwd->value();
}
delete win;
static char *exitError = nullptr;
static bool fatalError = false;
+static UserDialog dlg;
+
static const char *about_text()
{
static char buffer[1024];
return exitMainloop;
}
+void reset_password_data()
+{
+ dlg.resetPassword();
+}
+
void about_vncviewer()
{
fl_message_title(_("About TigerVNC Viewer"));
int main(int argc, char** argv)
{
const char *localedir;
- UserDialog dlg;
argv0 = argv[0];