Removes checks for mailsender since it should always be connected.

This commit is contained in:
Maxi Redigonda 2019-11-08 20:39:28 -03:00
parent 1c4bd7df17
commit 1d84aa488c
3 changed files with 15 additions and 27 deletions

View File

@ -69,8 +69,6 @@ class InviteStaffController extends Controller {
if(!$staffRow->isNull()) throw new RequestException(ERRORS::ALREADY_A_STAFF);
if(!MailSender::getInstance()->isConnected()) throw new RequestException(ERRORS::MAIL_SENDER_NOT_CONNECTED);
$staff = new Staff();
$staff->setProperties([
'name'=> $this->name,

View File

@ -26,7 +26,6 @@ DataValidator::with('CustomValidations', true);
* @apiUse ALREADY_BANNED
* @apiUse NO_PERMISSION
* @apiUse INVALID_CUSTOM_FIELD_OPTION
* @apiUse MAIL_SENDER_NOT_CONNECTED
*
* @apiSuccess {Object} data Information about invited user
* @apiSuccess {Number} data.userId Id of the invited user
@ -83,30 +82,26 @@ class InviteUserController extends Controller {
throw new RequestException(ERRORS::ALREADY_BANNED);
}
if(MailSender::getInstance()->isConnected()) {
$userId = $this->createNewUserAndRetrieveId();
$userId = $this->createNewUserAndRetrieveId();
$this->token = Hashing::generateRandomToken();
$this->token = Hashing::generateRandomToken();
$recoverPassword = new RecoverPassword();
$recoverPassword->setProperties(array(
'email' => $this->userEmail,
'token' => $this->token,
'staff' => false
));
$recoverPassword->store();
$recoverPassword = new RecoverPassword();
$recoverPassword->setProperties(array(
'email' => $this->userEmail,
'token' => $this->token,
'staff' => false
));
$recoverPassword->store();
$this->sendInvitationMail();
$this->sendInvitationMail();
Response::respondSuccess([
'userId' => $userId,
'userEmail' => $this->userEmail
]);
Response::respondSuccess([
'userId' => $userId,
'userEmail' => $this->userEmail
]);
Log::createLog('INVITE', $this->userName);
} else {
throw new RequestException(ERRORS::MAIL_SENDER_NOT_CONNECTED);
}
Log::createLog('INVITE', $this->userName);
}
public function storeRequestData() {

View File

@ -251,10 +251,6 @@
* @apiDefine INVALID_COLOR
* @apiError {String} INVALID_COLOR The color should be in hexadecimal, preceded by a '#'
*/
/**
* @apiDefine MAIL_SENDER_NOT_CONNECTED
* @apiError {String} MAIL_SENDER_NOT_CONNECTED The mail sender is not connected.
*/
class ERRORS {
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
@ -321,5 +317,4 @@ class ERRORS {
const INVALID_CUSTOM_FIELD_OPTION = 'INVALID_CUSTOM_FIELD_OPTION';
const UNAVAILABLE_STATS = 'UNAVAILABLE_STATS';
const INVALID_COLOR = 'INVALID_COLOR';
const MAIL_SENDER_NOT_CONNECTED = 'MAIL_SENDER_NOT_CONNECTED';
}