mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
Removes checks for mailsender since it should always be connected.
This commit is contained in:
parent
1c4bd7df17
commit
1d84aa488c
@ -69,8 +69,6 @@ class InviteStaffController extends Controller {
|
|||||||
|
|
||||||
if(!$staffRow->isNull()) throw new RequestException(ERRORS::ALREADY_A_STAFF);
|
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 = new Staff();
|
||||||
$staff->setProperties([
|
$staff->setProperties([
|
||||||
'name'=> $this->name,
|
'name'=> $this->name,
|
||||||
|
@ -26,7 +26,6 @@ DataValidator::with('CustomValidations', true);
|
|||||||
* @apiUse ALREADY_BANNED
|
* @apiUse ALREADY_BANNED
|
||||||
* @apiUse NO_PERMISSION
|
* @apiUse NO_PERMISSION
|
||||||
* @apiUse INVALID_CUSTOM_FIELD_OPTION
|
* @apiUse INVALID_CUSTOM_FIELD_OPTION
|
||||||
* @apiUse MAIL_SENDER_NOT_CONNECTED
|
|
||||||
*
|
*
|
||||||
* @apiSuccess {Object} data Information about invited user
|
* @apiSuccess {Object} data Information about invited user
|
||||||
* @apiSuccess {Number} data.userId Id of the 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);
|
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 = new RecoverPassword();
|
||||||
$recoverPassword->setProperties(array(
|
$recoverPassword->setProperties(array(
|
||||||
'email' => $this->userEmail,
|
'email' => $this->userEmail,
|
||||||
'token' => $this->token,
|
'token' => $this->token,
|
||||||
'staff' => false
|
'staff' => false
|
||||||
));
|
));
|
||||||
$recoverPassword->store();
|
$recoverPassword->store();
|
||||||
|
|
||||||
$this->sendInvitationMail();
|
$this->sendInvitationMail();
|
||||||
|
|
||||||
Response::respondSuccess([
|
Response::respondSuccess([
|
||||||
'userId' => $userId,
|
'userId' => $userId,
|
||||||
'userEmail' => $this->userEmail
|
'userEmail' => $this->userEmail
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Log::createLog('INVITE', $this->userName);
|
Log::createLog('INVITE', $this->userName);
|
||||||
} else {
|
|
||||||
throw new RequestException(ERRORS::MAIL_SENDER_NOT_CONNECTED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeRequestData() {
|
public function storeRequestData() {
|
||||||
|
@ -251,10 +251,6 @@
|
|||||||
* @apiDefine INVALID_COLOR
|
* @apiDefine INVALID_COLOR
|
||||||
* @apiError {String} INVALID_COLOR The color should be in hexadecimal, preceded by a '#'
|
* @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 {
|
class ERRORS {
|
||||||
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
|
const INVALID_CREDENTIALS = 'INVALID_CREDENTIALS';
|
||||||
@ -321,5 +317,4 @@ class ERRORS {
|
|||||||
const INVALID_CUSTOM_FIELD_OPTION = 'INVALID_CUSTOM_FIELD_OPTION';
|
const INVALID_CUSTOM_FIELD_OPTION = 'INVALID_CUSTOM_FIELD_OPTION';
|
||||||
const UNAVAILABLE_STATS = 'UNAVAILABLE_STATS';
|
const UNAVAILABLE_STATS = 'UNAVAILABLE_STATS';
|
||||||
const INVALID_COLOR = 'INVALID_COLOR';
|
const INVALID_COLOR = 'INVALID_COLOR';
|
||||||
const MAIL_SENDER_NOT_CONNECTED = 'MAIL_SENDER_NOT_CONNECTED';
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user