Subuser updates

This commit is contained in:
Dane Everitt 2017-01-21 00:04:09 -05:00
parent 95f574ec67
commit 8e9069cced
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 433 additions and 5 deletions

View file

@ -133,10 +133,15 @@ class SubuserRepository
// Determine if this user exists or if we need to make them an account.
$user = Models\User::where('email', $data['email'])->first();
if (! $user) {
$password = str_random(16);
try {
$repo = new UserRepository;
$uid = $repo->create($data['email'], $password);
$uid = $repo->create([
'email' => $data['email'],
'username' => substr(str_replace('@', '', $data['email']), 0, 8),
'name_first' => 'John',
'name_last' => 'Doe',
'root_admin' => false,
]);
$user = Models\User::findOrFail($uid);
} catch (\Exception $ex) {
throw $ex;