From 105331bf68f523de442fe144f4e2161ab6271e69 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Tue, 11 Jun 2019 12:47:12 -0600 Subject: [PATCH] Various fixes/notes for server compatibility --- README.md | 8 ++++++++ src/js/account/passwordReset.js | 2 +- src/js/migration.js | 2 +- src/php/api/Db.php | 2 +- src/php/api/User.php | 6 +++--- src/php/api/config.php.changeme | 1 + 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c19d1ae..2044a92 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/src/js/account/passwordReset.js b/src/js/account/passwordReset.js index 488563c..09b0853 100644 --- a/src/js/account/passwordReset.js +++ b/src/js/account/passwordReset.js @@ -109,5 +109,5 @@ function submitPasswordReset() { window.onload = (function (oldLoad) { oldLoad && oldLoad(); - setupPasswordResetForm(); + setTimeout(setupPasswordResetForm, 1000); })(window.onload); \ No newline at end of file diff --git a/src/js/migration.js b/src/js/migration.js index 07b90ec..bdb3170 100644 --- a/src/js/migration.js +++ b/src/js/migration.js @@ -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() { diff --git a/src/php/api/Db.php b/src/php/api/Db.php index 1f9696a..b753eaa 100644 --- a/src/php/api/Db.php +++ b/src/php/api/Db.php @@ -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; } diff --git a/src/php/api/User.php b/src/php/api/User.php index 784b9fd..4c84dbb 100644 --- a/src/php/api/User.php +++ b/src/php/api/User.php @@ -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 \r\n" - . "Reply-To: help@lexicon.ga\r\n" + $header = "From: Lexiconga Password Reset \r\n" + . "Reply-To: help@" . $_SERVER['HTTP_HOST'] . "\r\n" . "X-Mailer: PHP/" . phpversion(); if (mail($to, $subject, $message, $header)) { return true; diff --git a/src/php/api/config.php.changeme b/src/php/api/config.php.changeme index 99d1109..c00a3b7 100644 --- a/src/php/api/config.php.changeme +++ b/src/php/api/config.php.changeme @@ -1,5 +1,6 @@