Commit 271e93ba authored by Jacob Priddy's avatar Jacob Priddy 👌

Losten up user create requirements

parent 628e1f6d
Pipeline #10702 passed with stages
in 2 minutes and 58 seconds
......@@ -85,10 +85,10 @@ class UsersController extends ApiController
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'display_name' => 'required|string|max:255',
'emplid' => 'nullable|string|max:7|min:6',
'email' => 'required|email|max:255',
'emplid' => 'nullable|string|max:7|min:6',
'password' => 'nullable|string|min:15|max:255',
'doorcode' => 'required|string|numeric|digits_between:4,255',
'doorcode' => 'nullable|string|numeric|digits_between:4,255',
'expires_at' => 'nullable|string|date|max:255',
]);
......
......@@ -39,6 +39,8 @@ class CreateUser implements CreateUserUseCase
$password = $attributes['password'] ?? '';
$doorcode = $attributes['doorcode'] ?? null;
// ID, createdAt, and updatedAt will get overwritten
$user = new User(
0,
......@@ -48,10 +50,8 @@ class CreateUser implements CreateUserUseCase
$attributes['email'],
$emplid,
Password::hash($password),
HashedSearchable::hash($this->salt, $attributes['doorcode']),
$expires,
null,
null
HashedSearchable::hash($this->salt, $doorcode),
$expires
);
......
......@@ -13,11 +13,11 @@ interface CreateUserUseCase
* last_name
* display_name
* email
* password
* doorcode
* Optional attributes
* emplid
* expires_at
* password
* doorcode
*
* @param array $attributes
* @param Presenter $presenter
......
......@@ -98,15 +98,6 @@ class CreateUserApiTest extends AuthenticatesWithApplicationTestCase
],
['email' => ['The email field is required.']],
],
[
[
'first_name' => $user->getFirstName(),
'last_name' => $user->getLastName(),
'display_name' => $user->getDisplayName(),
'email' => $user->getEmail(),
],
['doorcode' => ['The doorcode field is required.']],
],
// emplid is too small
[
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment