diff options
Diffstat (limited to 'src/inputdialog.c')
| -rw-r--r-- | src/inputdialog.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/inputdialog.c b/src/inputdialog.c index a601085..d17b852 100644 --- a/src/inputdialog.c +++ b/src/inputdialog.c | |||
| @@ -156,6 +156,44 @@ gchar *input_dialog_query_password(const gchar *server, const gchar *user) | |||
| 156 | return pass; | 156 | return pass; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | gchar *input_dialog_query_master_password(void) | ||
| 160 | { | ||
| 161 | return input_dialog_with_invisible(_("Input password"), | ||
| 162 | _("Master password"), | ||
| 163 | NULL); | ||
| 164 | } | ||
| 165 | |||
| 166 | gchar *input_dialog_set_new_password(guint max_attempts) | ||
| 167 | { | ||
| 168 | guint cnt; | ||
| 169 | gchar *pass1, *pass2; | ||
| 170 | |||
| 171 | if (max_attempts < 1) | ||
| 172 | return NULL; | ||
| 173 | |||
| 174 | for (cnt = 0; cnt < max_attempts; ++cnt) { | ||
| 175 | pass1 = input_dialog_with_invisible( | ||
| 176 | _("Input password"), | ||
| 177 | _("New password"), | ||
| 178 | NULL); | ||
| 179 | pass2 = input_dialog_with_invisible( | ||
| 180 | _("Input password"), | ||
| 181 | _("Confirm new password"), | ||
| 182 | NULL); | ||
| 183 | if (strcmp(pass1, pass2) == 0) { | ||
| 184 | /* TODO: clear before free? */ | ||
| 185 | g_free(pass2); | ||
| 186 | break; | ||
| 187 | } | ||
| 188 | /* TODO: clear before free? */ | ||
| 189 | g_free(pass2); | ||
| 190 | g_free(pass1); | ||
| 191 | pass1 = NULL; | ||
| 192 | } | ||
| 193 | |||
| 194 | return pass1; | ||
| 195 | } | ||
| 196 | |||
| 159 | gchar *input_dialog_with_filesel(const gchar *title, const gchar *message, | 197 | gchar *input_dialog_with_filesel(const gchar *title, const gchar *message, |
| 160 | const gchar *default_string, | 198 | const gchar *default_string, |
| 161 | GtkFileChooserAction action) | 199 | GtkFileChooserAction action) |
