Skip to content

Commit

Permalink
Various fixes/notes for server compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Alamantus authored and robbie-inquisicorp committed Jul 11, 2019
1 parent 377e71d commit 105331b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/js/account/passwordReset.js
Expand Up @@ -109,5 +109,5 @@ function submitPasswordReset() {

window.onload = (function (oldLoad) {
oldLoad && oldLoad();
setupPasswordResetForm();
setTimeout(setupPasswordResetForm, 1000);
})(window.onload);
2 changes: 1 addition & 1 deletion src/js/migration.js
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/php/api/Db.php
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/php/api/User.php
Expand Up @@ -283,12 +283,12 @@ public function setPasswordReset($email) {
$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;
Expand Down
1 change: 1 addition & 0 deletions src/php/api/config.php.changeme
@@ -1,5 +1,6 @@
<?php

define('DB_NAME', 'lexiconga_db_name');
define('DB_USER', 'lexiconga_db_username');
define('DB_PASSWORD', 'user_password');

Expand Down

0 comments on commit 105331b

Please sign in to comment.