Various fixes/notes for server compatibility

This commit is contained in:
Robbie Antenesse 2019-06-11 12:47:12 -06:00 committed by Robbie Antenesse
parent 377e71daf8
commit 105331bf68
6 changed files with 15 additions and 6 deletions

View File

@ -33,3 +33,11 @@ There is a script called `src/php/api/migrate.php.changeme` that can be used to
Visit `migrate.php` on your `version1` server with `?outgoing=true` set in order to begin the transfer. The other server's `migrate.php` will receive an "incoming" request multiple times, and your screen will display messages as it works.
_DELETE THESE `migrate.php` FILES IMMEDIATELY AFTER MIGRATION IS COMPLETE!_.
## Emails
Be sure you set up email senders/receivers for at least these 3 email addresses:
- help (can be forwarder)
- donotreply (must be sender)
- ads (can be forwarder)

View File

@ -109,5 +109,5 @@ function submitPasswordReset() {
window.onload = (function (oldLoad) {
oldLoad && oldLoad();
setupPasswordResetForm();
setTimeout(setupPasswordResetForm, 1000);
})(window.onload);

View File

@ -11,7 +11,7 @@ export default function migrate() {
}
function isNotSecure() {
return window.location.host !== 'localhost' && window.location.protocol !== 'https';
return window.location.host !== 'localhost' && window.location.protocol !== 'https:';
}
function sendDictionaryToHTTPS() {

View File

@ -5,7 +5,7 @@ class Db {
private $dbh;
public $last_error_info;
function __construct() {
$this->dbh = new PDO('mysql:host=localhost;dbname=lexiconga;charset=utf8', DB_USER, DB_PASSWORD);
$this->dbh = new PDO('mysql:host=localhost;dbname=' . DB_NAME . ';charset=utf8', DB_USER, DB_PASSWORD);
$this->dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$this->last_error_info = null;
}

View File

@ -283,12 +283,12 @@ VALUES (?, ?, ?, ?, current_timestamp())';
$to = $email;
$subject = "Here's your Lexiconga password reset link";
$message = "Hello " . $user_data['public_name'] . "\r\n\r\nSomeone has requested a password reset link for your Lexiconga account. If it was you, you can reset your password by going to the link below and entering a new password for yourself:\r\n";
$message .= "https://lexicon.ga/passwordreset.php?account=" . $user_data['id'] . "&code=" . $reset_code_hash . "\r\n\r\n";
$message .= "https://" . $_SERVER['HTTP_HOST'] . "/passwordreset.php?account=" . $user_data['id'] . "&code=" . $reset_code_hash . "\r\n\r\n";
$message .= "If it wasn't you who requested the link, you can ignore this email since it was only sent to you, but you might want to consider changing your password when you have a chance.\r\n\r\n";
$message .= "The password link will only be valid for today until you use it.\r\n\r\n";
$message .= "Thanks!\r\nThe Lexiconga Admins";
$header = "From: Lexiconga Password Reset <donotreply@lexicon.ga>\r\n"
. "Reply-To: help@lexicon.ga\r\n"
$header = "From: Lexiconga Password Reset <donotreply@" . $_SERVER['HTTP_HOST'] . ">\r\n"
. "Reply-To: help@" . $_SERVER['HTTP_HOST'] . "\r\n"
. "X-Mailer: PHP/" . phpversion();
if (mail($to, $subject, $message, $header)) {
return true;

View File

@ -1,5 +1,6 @@
<?php
define('DB_NAME', 'lexiconga_db_name');
define('DB_USER', 'lexiconga_db_username');
define('DB_PASSWORD', 'user_password');