add verification of email on staffs
This commit is contained in:
parent
fe1dd1bd48
commit
bfb7256400
|
@ -85,7 +85,11 @@ class EditStaffController extends Controller {
|
||||||
private function editInformation() {
|
private function editInformation() {
|
||||||
|
|
||||||
if(Controller::request('email')) {
|
if(Controller::request('email')) {
|
||||||
$this->staffInstance->email = Controller::request('email');
|
$newEmail = Controller::request('email');
|
||||||
|
|
||||||
|
$this->verifyEmail($newEmail);
|
||||||
|
|
||||||
|
$this->staffInstance->email = $newEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Controller::request('password')) {
|
if(Controller::request('password')) {
|
||||||
|
@ -131,6 +135,19 @@ class EditStaffController extends Controller {
|
||||||
$this->staffInstance->store();
|
$this->staffInstance->store();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function verifyEmail($email){
|
||||||
|
|
||||||
|
$staff = Staff::getDataStore($email,'email');
|
||||||
|
$user = User::getDataStore($email,'email');
|
||||||
|
|
||||||
|
if($user->email == $email){
|
||||||
|
throw new RequestException(ERRORS::INVALID_EMAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($staff->email == $email && $this->staffInstance->email != $email){
|
||||||
|
throw new RequestException(ERRORS::INVALID_EMAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function getDepartmentList() {
|
private function getDepartmentList() {
|
||||||
$listDepartments = new DataStoreList();
|
$listDepartments = new DataStoreList();
|
||||||
|
|
Loading…
Reference in New Issue