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({
|
||||
path: '/staff/edit',
|
||||
data: {
|
||||
staffId: this.props.staffId,
|
||||
staffId: (!this.props.myAccount) ? this.props.staffId : null,
|
||||
sendEmailOnNewTicket: (eventType === 'SEND_EMAIL_ON_NEW_TICKET') ? form.sendEmailOnNewTicket * 1 : null,
|
||||
email: (eventType === 'EMAIL') ? form.email : null,
|
||||
password: (eventType === 'PASSWORD') ? form.password : null,
|
||||
|
|
|
@ -36,7 +36,21 @@ class EditStaffController extends Controller {
|
|||
public function validations() {
|
||||
return [
|
||||
'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;
|
||||
}
|
||||
} else {
|
||||
Response::respondError(ERRORS::NO_PERMISSION);
|
||||
Response::respondError($staffId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue