mirror of https://github.com/MISP/MISP
chg: [users/emails] Better comments
parent
6bb31fbb1d
commit
2152493dd0
|
@ -1375,17 +1375,18 @@ class UsersController extends AppController
|
||||||
$this->set('user', $user);
|
$this->set('user', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function admin_email($isTest=false)
|
public function admin_email($isPreview=false)
|
||||||
{
|
{
|
||||||
if (!$this->_isAdmin()) {
|
if (!$this->_isAdmin()) {
|
||||||
throw new MethodNotAllowedException();
|
throw new MethodNotAllowedException();
|
||||||
}
|
}
|
||||||
// User has filled in his contact form, send out the email.
|
|
||||||
$isPostOrPut = $this->request->is('post') || $this->request->is('put');
|
$isPostOrPut = $this->request->is('post') || $this->request->is('put');
|
||||||
$conditions = array();
|
$conditions = array();
|
||||||
if (!$this->_isSiteAdmin()) {
|
if (!$this->_isSiteAdmin()) {
|
||||||
$conditions = array('org_id' => $this->Auth->user('org_id'));
|
$conditions = array('org_id' => $this->Auth->user('org_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// harvest parameters
|
||||||
if ($isPostOrPut) {
|
if ($isPostOrPut) {
|
||||||
$recipient = $this->request->data['User']['recipient'];
|
$recipient = $this->request->data['User']['recipient'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1416,13 +1417,14 @@ class UsersController extends AppController
|
||||||
$conditions['AND'][] = array('User.disabled' => 0);
|
$conditions['AND'][] = array('User.disabled' => 0);
|
||||||
|
|
||||||
// Allow to mimic real form post
|
// Allow to mimic real form post
|
||||||
if ($isTest) {
|
if ($isPreview) {
|
||||||
$users = $this->User->find('list', array('recursive' => -1, 'order' => array('email ASC'), 'conditions' => $conditions, 'fields' => array('email')));
|
$users = $this->User->find('list', array('recursive' => -1, 'order' => array('email ASC'), 'conditions' => $conditions, 'fields' => array('email')));
|
||||||
$this->set('emails', $users);
|
$this->set('emails', $users);
|
||||||
$this->set('emailsCount', count($users));
|
$this->set('emailsCount', count($users));
|
||||||
$this->render('ajax/emailConfirmTemplate');
|
$this->render('ajax/emailConfirmTemplate');
|
||||||
} else {
|
} else {
|
||||||
$users = $this->User->find('all', array('recursive' => -1, 'order' => array('email ASC'), 'conditions' => $conditions));
|
$users = $this->User->find('all', array('recursive' => -1, 'order' => array('email ASC'), 'conditions' => $conditions));
|
||||||
|
// User has filled in his contact form, send out the email.
|
||||||
if ($isPostOrPut) {
|
if ($isPostOrPut) {
|
||||||
$this->request->data['User']['message'] = $this->User->adminMessageResolve($this->request->data['User']['message']);
|
$this->request->data['User']['message'] = $this->User->adminMessageResolve($this->request->data['User']['message']);
|
||||||
$failures = '';
|
$failures = '';
|
||||||
|
|
Loading…
Reference in New Issue