mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
fix bug #288 and add validatios
This commit is contained in:
parent
20fbfa1e05
commit
e43835b2bc
@ -290,7 +290,7 @@ class StaffEditor extends React.Component {
|
|||||||
API.call({
|
API.call({
|
||||||
path: '/staff/edit',
|
path: '/staff/edit',
|
||||||
data: {
|
data: {
|
||||||
staffId: this.props.staffId,
|
staffId: (!this.props.myAccount) ? this.props.staffId : null,
|
||||||
sendEmailOnNewTicket: (eventType === 'SEND_EMAIL_ON_NEW_TICKET') ? form.sendEmailOnNewTicket * 1 : null,
|
sendEmailOnNewTicket: (eventType === 'SEND_EMAIL_ON_NEW_TICKET') ? form.sendEmailOnNewTicket * 1 : null,
|
||||||
email: (eventType === 'EMAIL') ? form.email : null,
|
email: (eventType === 'EMAIL') ? form.email : null,
|
||||||
password: (eventType === 'PASSWORD') ? form.password : null,
|
password: (eventType === 'PASSWORD') ? form.password : null,
|
||||||
|
@ -36,7 +36,21 @@ class EditStaffController extends Controller {
|
|||||||
public function validations() {
|
public function validations() {
|
||||||
return [
|
return [
|
||||||
'permission' => 'staff_1',
|
'permission' => 'staff_1',
|
||||||
'requestData' => []
|
'requestData' => [
|
||||||
|
'email' => [
|
||||||
|
'validation' => DataValidator::oneOf(DataValidator::email(), DataValidator::falseVal()),
|
||||||
|
'error' => ERRORS::INVALID_EMAIL
|
||||||
|
],
|
||||||
|
'password' => [
|
||||||
|
'validation' => DataValidator::oneOf(DataValidator::length(5, 200), DataValidator::falseVal()),
|
||||||
|
'error' => ERRORS::INVALID_PASSWORD
|
||||||
|
],
|
||||||
|
'level' => [
|
||||||
|
'validation' => DataValidator::oneOf(DataValidator::between(1, 3, true), DataValidator::falseVal()),
|
||||||
|
'error' => ERRORS::INVALID_LEVEL
|
||||||
|
]
|
||||||
|
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +67,7 @@ class EditStaffController extends Controller {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Response::respondError(ERRORS::NO_PERMISSION);
|
Response::respondError($staffId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user