diff --git a/src/Core/database.sql b/src/Core/database.sql index 815cfd9..4b0fa27 100644 --- a/src/Core/database.sql +++ b/src/Core/database.sql @@ -25,7 +25,7 @@ CREATE TABLE `vehicle` ( `CurrentLocation` VARCHAR(255), `NumOfAllocations` INT, `IsLeased` TINYINT(1), - `VehiclePicturePath` VARCHAR(50), + `VehiclePicturePath` VARCHAR(255), `IsDeleted` TINYINT(1) DEFAULT 0, PRIMARY KEY (`RegistrationNo`), FOREIGN KEY (AssignedOfficer) REFERENCES employee(EmpID) ON UPDATE CASCADE diff --git a/src/EmailClient/EmailGenerator.class.php b/src/EmailClient/EmailGenerator.class.php index dca1ca7..8a3bbed 100644 --- a/src/EmailClient/EmailGenerator.class.php +++ b/src/EmailClient/EmailGenerator.class.php @@ -224,7 +224,11 @@ public function newAccountNotification(string $email, string $password) ->subject('New User Account') ->paragraph() ->text('A new account has been created for you in Vehicle Fleet Management System.') + ->close() + ->paragraph() ->text("Email: $email") + ->close() + ->paragraph() ->text("Password: $password") ->close() ->getEmail(); diff --git a/src/Employee/Factory/Privileged/PrivilegedEmployeeFactory.class.php b/src/Employee/Factory/Privileged/PrivilegedEmployeeFactory.class.php index 00a0068..0b1044b 100644 --- a/src/Employee/Factory/Privileged/PrivilegedEmployeeFactory.class.php +++ b/src/Employee/Factory/Privileged/PrivilegedEmployeeFactory.class.php @@ -5,6 +5,7 @@ use DB\Viewer\EmployeeViewer; use Exception; use Request\Factory\Base\RealRequest; +use EmailClient\EmailClient; class PrivilegedEmployeeFactory { @@ -39,7 +40,11 @@ public static function makeNewEmployee(array $values): PrivilegedEmployee if (!self::checkAccess()) throw new Exception('Illegel Access'); $values['ProfilePicturePath'] = ''; - $values['Password']=password_hash(self::generateRandomPassword(), PASSWORD_BCRYPT); + + $emailClient = EmailClient::getInstance(); + $password = self::generateRandomPassword(); + $emailClient->notifyNewAccount($values['Email'],$password); + $values['Password']=password_hash($password, PASSWORD_BCRYPT); $employee = self::createConcreteEmployee($values); $employee->saveToDatabase(); return self::castToEmployee($employee);