Skip to content

Commit

Permalink
Add a page to handle IMAP/POP3 credentials update
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Jul 27, 2020
1 parent 7a46e0e commit c763233
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions mailbox/inbox_login_error.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/local/bin/perl
# inbox_login_error.cgi
# Let user update IMAP/POP3 login credentials
use strict;
use warnings;
our (%text, %in);
our ($remote_user, $remote_pass);

require './mailbox-lib.pl';
&ReadParse();

my @folders = &list_folders_sorted();
my ($folder) = grep { $_->{'index'} == $in{'folder'} } @folders;

# Check if this is a POP3 or IMAP inbox with no login set
if ($folder->{'type'} == 2 || $folder->{'type'} == 4) {
&ui_print_header(undef, &text('error'), undef,
undef, undef, 1);
print &ui_form_start("inbox_login.cgi", "post");
print &ui_hidden("folder", $folder->{'index'}),"\n";
print &ui_table_start(
$folder->{'type'} == 2 ? $text{'mail_loginheader'}
: $text{'mail_loginheader2'}, undef, 2);
print &ui_table_row(undef, &text('mail_logindesc',
"<tt>$folder->{'server'}</tt>"), 2);

print &ui_table_row($text{'mail_loginuser'},
&ui_textbox("user", $remote_user, 30));
print &ui_table_row($text{'mail_loginpass'},
&ui_password("pass", $remote_pass, 30));

print &ui_table_end();
print &ui_form_end([ [ "login", $text{'mail_login'} ] ]);
}
else {
error(text('mail_unknown'));
}

2 comments on commit c763233

@iliajie
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iliajie
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Please sign in to comment.