diff --git a/app/main/controller/api/user.php b/app/main/controller/api/user.php
index 34e9b074..fd3c4012 100644
--- a/app/main/controller/api/user.php
+++ b/app/main/controller/api/user.php
@@ -277,9 +277,12 @@ class User extends Controller\Controller{
$newUserData = null;
- // check user if if he is new
+ // check for new user
$loginAfterSave = false;
+ // send registration mail
+ $sendRegistrationMail = false;
+
// valid registration key Model is required for new registration
// if "invite" feature is enabled
$registrationKeyModel = false;
@@ -314,6 +317,7 @@ class User extends Controller\Controller{
// new user registration
$user = $mapType = Model\BasicModel::getNew('UserModel');
$loginAfterSave = true;
+ $sendRegistrationMail = true;
// set username
if(
@@ -344,6 +348,9 @@ class User extends Controller\Controller{
$settingsData['password'] == $settingsData['password_confirm']
){
$user->password = $settingsData['password'];
+
+ // pw changed -> send mail
+ $sendRegistrationMail = true;
}
}else{
// captcha was send but not valid -> return error
@@ -444,6 +451,12 @@ class User extends Controller\Controller{
// get fresh updated user object
$user = $this->_getUser(0);
$newUserData = $user->getData();
+
+ // send registration mail with account information
+ if($sendRegistrationMail){
+ $this->sendRegistration($user, $settingsData['password']);
+ }
+
}
}catch(Exception\ValidationException $e){
$validationError = (object) [];
@@ -466,13 +479,30 @@ class User extends Controller\Controller{
echo json_encode($return);
}
+ /**
+ * send registration mail to user
+ * @param $user
+ * @param $password
+ * @return mixed
+ */
+ protected function sendRegistration($user, $password){
+
+ $msg = 'Username: ' . $user->name . '
';
+ $msg .= 'Password: ' . $password . '
';
+
+ $mailController = new MailController();
+ $status = $mailController->sendRegistration($user->email, $msg);
+
+ return $status;
+ }
+
/**
* send mail with registration key
* -> check INVITE in pathfinder.ini
* @param $f3
* @throws Exception
*/
- public function sendRegistration($f3){
+ public function sendInvite($f3){
$data = $f3->get('POST.settingsData');
$return = (object) [];
@@ -529,7 +559,7 @@ class User extends Controller\Controller{
}else{
$validationError = (object) [];
$validationError->type = 'warning';
- $validationError->message = 'The number of keys is limited per an Email. You can not get more keys';
+ $validationError->message = 'The number of keys is limited by Email. You can not get more keys';
$return->error[] = $validationError;
}
@@ -542,7 +572,7 @@ class User extends Controller\Controller{
$msg = 'Your personal Registration Key: ' . $registrationKeyModel->registrationKey;
$mailController = new MailController();
- $status = $mailController->sendRegistrationKey($email, $msg);
+ $status = $mailController->sendInviteKey($email, $msg);
if( $status ){
$registrationKeyModel->email = $email;
diff --git a/app/main/controller/mailcontroller.php b/app/main/controller/mailcontroller.php
index a9ac629c..69aad51c 100644
--- a/app/main/controller/mailcontroller.php
+++ b/app/main/controller/mailcontroller.php
@@ -23,22 +23,36 @@ class MailController extends \SMTP{
// error handling
$this->set('Errors-to', '' . Controller::getEnvironmentData('SMTP_ERROR') . '>');
+ $this->set('MIME-Version', '1.0');
+ $this->set('Content-Type', 'text/html; charset=ISO-8859-1');
}
/**
- * send registration key
+ * send registration mail
* @param $to
* @param $msg
* @return bool
*/
- public function sendRegistrationKey($to, $msg){
+ public function sendRegistration($to, $msg){
+ $this->set('To', '<' . $to . '>');
+ $this->set('From', 'Pathfinder <' . Controller::getEnvironmentData('SMTP_FROM') . '>');
+ $this->set('Subject', 'Account information');
+ $status = $this->send($msg);
+
+ return $status;
+ }
+
+ /**
+ * send invite key mail
+ * @param $to
+ * @param $msg
+ * @return bool
+ */
+ public function sendInviteKey($to, $msg){
$this->set('To', '<' . $to . '>');
$this->set('From', 'Pathfinder <' . Controller::getEnvironmentData('SMTP_FROM') . '>');
$this->set('Subject', 'Registration Key');
- $this->set('Error-To', '<' . Controller::getEnvironmentData('SMTP_ERROR') . '>');
- $this->set('MIME-Version', '1.0');
- $this->set('Content-Type', 'text/html; charset=ISO-8859-1');
$status = $this->send($msg);
return $status;
diff --git a/app/main/data/mapper/ccpsystemsmapper.php b/app/main/data/mapper/ccpsystemsmapper.php
index 1095e30e..92f6addc 100644
--- a/app/main/data/mapper/ccpsystemsmapper.php
+++ b/app/main/data/mapper/ccpsystemsmapper.php
@@ -10,15 +10,15 @@ namespace Data\Mapper;
class CcpSystemsMapper extends \RecursiveArrayIterator {
- static $map = array(
+ static $map = [
'system_id' => 'systemId',
'system_name' => 'name',
'system_security' => 'trueSec',
- 'connstallation_id' => array('constellation' => 'id'),
- 'constallation_name' => array('constellation' => 'name'),
- 'region_id' => array('region' => 'id'),
- 'region_name' => array('region' => 'name')
- );
+ 'connstallation_id' => ['constellation' => 'id'],
+ 'constallation_name' => ['constellation' => 'name'],
+ 'region_id' => ['region' => 'id'],
+ 'region_name' => ['region' => 'name']
+ ];
function __construct($data){
@@ -106,7 +106,7 @@ class CcpSystemsMapper extends \RecursiveArrayIterator {
];
};
- iterator_apply($this, 'self::recursiveIterator', array($this));
+ iterator_apply($this, 'self::recursiveIterator', [$this]);
return iterator_to_array($this, false);
@@ -143,7 +143,7 @@ class CcpSystemsMapper extends \RecursiveArrayIterator {
$iterator->offsetSet( $parentKey, $currentValue );
}else{
- $iterator->offsetSet( $parentKey, array($entryKey => $iterator->current() ) );
+ $iterator->offsetSet( $parentKey, [$entryKey => $iterator->current() ] );
}
$removeOldEntry = true;
diff --git a/js/app/init.js b/js/app/init.js
index 6d496f12..9e901f8c 100644
--- a/js/app/init.js
+++ b/js/app/init.js
@@ -11,7 +11,7 @@ define(['jquery'], function($) {
img: 'public/img/', // path for images
// user API
getCaptcha: 'api/user/getCaptcha', // ajax URL - get captcha image
- sendRegistrationKey: 'api/user/sendRegistration', // ajax URL - send registration key
+ sendInviteKey: 'api/user/sendInvite', // ajax URL - send registration key
logIn: 'api/user/logIn', // ajax URL - login
logOut: 'api/user/logOut', // ajax URL - logout
deleteLog: 'api/user/deleteLog', // ajax URL - delete character log
diff --git a/js/app/landingpage.js b/js/app/landingpage.js
index 28fb0d93..c5eaf9cb 100644
--- a/js/app/landingpage.js
+++ b/js/app/landingpage.js
@@ -192,7 +192,7 @@ define([
$.ajax({
type: 'POST',
- url: Init.path.sendRegistrationKey,
+ url: Init.path.sendInviteKey,
data: requestData,
dataType: 'json'
}).done(function(responseData){