refactoring

This commit is contained in:
Roland Gruber 2020-02-15 21:38:07 +01:00
parent c0e1e026d8
commit 59e9635e90
1 changed files with 8 additions and 8 deletions

View File

@ -226,18 +226,18 @@ class imapAccess extends baseModule {
$prefix = $this->getMailboxPrefix(); $prefix = $this->getMailboxPrefix();
$email_domain = substr(strstr($this->email, '@'), 1); $email_domain = substr(strstr($this->email, '@'), 1);
$password = $this->getAdminPassword(); // check for password for fall back mechanism $adminPassword = $this->getAdminPassword(); // check for password for fall back mechanism
if (!isset($_SESSION['imapAdmPass']) && !isset($password)) { if (!isset($_SESSION['imapAdmPass']) && !isset($adminPassword)) {
return $this->display_html_password(); return $this->display_html_password();
} }
$return->addLabel(new htmlOutputText(_('Email address'))); $return->addLabel(new htmlOutputText(_('Email address')));
$return->addField(new htmlOutputText($this->email)); $return->addField(new htmlOutputText($this->email));
$user = $this->getAdminUser(); $adminUser = $this->getAdminUser();
$password = $this->getAdminPassword(); $adminPassword = $this->getAdminPassword();
try { try {
$client = $this->connect($user, $password); $client = $this->connect($adminUser, $adminPassword);
} }
catch (LAMException $e) { catch (LAMException $e) {
return $this->display_html_password(new htmlStatusMessage('ERROR', $e->getTitle(), $e->getMessage())); return $this->display_html_password(new htmlStatusMessage('ERROR', $e->getTitle(), $e->getMessage()));
@ -635,11 +635,11 @@ class imapAccess extends baseModule {
*/ */
function doLogin() { function doLogin() {
$errors = array(); $errors = array();
$user = $this->getAdminUser(); $adminUser = $this->getAdminUser();
if (isset($_POST['ImapAdminPassword']) && $_POST['ImapAdminPassword'] != "") { if (isset($_POST['ImapAdminPassword']) && $_POST['ImapAdminPassword'] != "") {
$password = $_POST['ImapAdminPassword']; $adminPassword = $_POST['ImapAdminPassword'];
try { try {
$client = $this->connect($user, $password); $client = $this->connect($adminUser, $adminPassword);
$_SESSION['imapAdmPass'] = lamEncrypt($_POST['ImapAdminPassword']); $_SESSION['imapAdmPass'] = lamEncrypt($_POST['ImapAdminPassword']);
$client->logout(); $client->logout();
} }