function getMailer() { // Choose mail transport method; either smtp or sendmail $mail_method = get_config('mail_method'); $crypto = new \Elabftw\Elabftw\CryptoWrapper(); switch ($mail_method) { // Use SMTP Server case 'smtp': $transport = Swift_SmtpTransport::newInstance(get_config('smtp_address'), get_config('smtp_port'), get_config('smtp_encryption'))->setUsername(get_config('smtp_username'))->setPassword($crypto->decrypt(get_config('smtp_password'))); break; // Use php mail function // Use php mail function case 'php': $transport = Swift_MailTransport::newInstance(); break; // Use locally installed MTA (aka sendmail); Default // Use locally installed MTA (aka sendmail); Default default: $transport = Swift_SendmailTransport::newInstance(get_config('sendmail_path') . ' -bs'); break; } $mailer = Swift_Mailer::newInstance($transport); return $mailer; }
header("location: ../login.php"); exit; } /* * SECOND PART * * Update the passwords. */ if (isset($_POST['password']) && isset($_POST['cpassword']) && isset($_POST['key']) && isset($_POST['userid']) && $_POST['password'] === $_POST['cpassword']) { // get email of user $sql = "SELECT email FROM users WHERE userid = :userid"; $req = $pdo->prepare($sql); $req->bindParam(':userid', $_POST['userid'], PDO::PARAM_INT); $req->execute(); // Validate key if ($req->fetchColumn() != $crypto->decrypt($_POST['key'])) { die('Bad key.'); } // Get userid if (filter_var($_POST['userid'], FILTER_VALIDATE_INT)) { $userid = $_POST['userid']; } else { die(_("Userid is not valid.")); } // Replace new password in database if ($user->updatePassword($_POST['password'], $userid)) { dblog('Info', $userid, 'Password was changed for this user.'); $msg_arr[] = _('New password updated. You can now login.'); $_SESSION['infos'] = $msg_arr; } else { $msg_arr[] = sprintf(_("There was an unexpected problem! Please %sopen an issue on GitHub%s if you think this is a bug.") . "<br>E#452A" . $error, "<a href='https://github.com/elabftw/elabftw/issues/'>", "</a>");
* */ require_once 'inc/common.php'; if ($_SESSION['is_sysadmin'] != 1) { die(_('This section is out of your reach.')); } $page_title = _('eLabFTW configuration'); $selected_menu = null; require_once 'inc/head.php'; $formKey = new \Elabftw\Elabftw\FormKey(); $crypto = new \Elabftw\Elabftw\CryptoWrapper(); $stamppass = get_config('stamppass'); $smtppass = get_config('smtp_password'); if (strlen($stamppass) > 0) { try { $stamppass = $crypto->decrypt($stamppass); } catch (Exception $e) { display_message('error', $e->getMessage()); } } if (strlen($smtppass) > 0) { try { $smtppass = $crypto->decrypt($smtppass); } catch (Exception $e) { display_message('error', $e->getMessage()); } } $update = new \Elabftw\Elabftw\Update(); try { $update->getUpdatesIni(); } catch (Exception $e) {
$message .= "<form method='post' action='app/admin-exec.php'>"; $message .= $formKey->getFormkey(); $message .= "<ul>"; while ($data = $user_req->fetch()) { $message .= "<li><label>\n <input type='checkbox' name='validate[]'\n value='" . $data['userid'] . "'> " . $data['firstname'] . " " . $data['lastname'] . " (" . $data['email'] . ")\n </label></li>"; } $message .= "</ul><div class='center'>\n <button class='button' type='submit'>" . _('Submit') . "</button></div>"; display_message('error', $message); echo "</form>"; } // get the team config $team = get_team_config(); $stamppass = ''; if (!empty($team['stamppass'])) { try { $stamppass = $crypto->decrypt($team['stamppass']); } catch (Exception $e) { $stamppass = ''; } } ?> <menu> <ul> <li class='tabhandle' id='tab1'><?php echo _('Team'); ?> </li> <li class='tabhandle' id='tab2'><?php echo _('Users');