user: remove name_first and name_last

This commit is contained in:
Matthew Penner 2022-12-14 18:17:27 -07:00
parent 2f15d94957
commit 6b11836a41
No known key found for this signature in database
8 changed files with 7 additions and 23 deletions

View file

@ -44,10 +44,10 @@ class DeleteUserCommand extends Command
if ($this->input->isInteractive()) {
$tableValues = [];
foreach ($results as $user) {
$tableValues[] = [$user->id, $user->email, $user->name];
$tableValues[] = [$user->id, $user->email, $user->username];
}
$this->table(['User ID', 'Email', 'Name'], $tableValues);
$this->table(['User ID', 'Email', 'Username'], $tableValues);
if (!$deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) {
return $this->handle();
}

View file

@ -30,8 +30,6 @@ class MakeUserCommand extends Command
$root_admin = $this->option('admin') ?? $this->confirm(trans('command/messages.user.ask_admin'));
$email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email'));
$username = $this->option('username') ?? $this->ask(trans('command/messages.user.ask_username'));
$name_first = $this->option('name-first') ?? $this->ask(trans('command/messages.user.ask_name_first'));
$name_last = $this->option('name-last') ?? $this->ask(trans('command/messages.user.ask_name_last'));
if (is_null($password = $this->option('password')) && !$this->option('no-password')) {
$this->warn(trans('command/messages.user.ask_password_help'));
@ -39,12 +37,11 @@ class MakeUserCommand extends Command
$password = $this->secret(trans('command/messages.user.ask_password'));
}
$user = $this->creationService->handle(compact('email', 'username', 'name_first', 'name_last', 'password', 'root_admin'));
$user = $this->creationService->handle(compact('email', 'username', 'password', 'root_admin'));
$this->table(['Field', 'Value'], [
['UUID', $user->uuid],
['Email', $user->email],
['Username', $user->username],
['Name', $user->name],
['Admin', $user->root_admin ? 'Yes' : 'No'],
]);
}

View file

@ -43,7 +43,6 @@ use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification;
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ApiKey[] $apiKeys
* @property int|null $api_keys_count
* @property string $name
* @property \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property int|null $notifications_count
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\RecoveryToken[] $recoveryTokens
@ -223,14 +222,6 @@ class User extends Model implements
$this->attributes['username'] = mb_strtolower($value);
}
/**
* Return a concatenated result for the accounts full name.
*/
public function getNameAttribute(): string
{
return trim($this->name_first . ' ' . $this->name_last);
}
public function avatarURL(): string
{
return 'https://www.gravatar.com/avatar/' . md5($this->email) . '.jpg';

View file

@ -33,7 +33,7 @@ class AccountCreated extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$message = (new MailMessage())
->greeting('Hello ' . $this->user->name . '!')
->greeting('Hello!')
->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.')
->line('Username: ' . $this->user->username)
->line('Email: ' . $this->user->email);

View file

@ -21,7 +21,7 @@ class MailTested extends Notification
{
return (new MailMessage())
->subject('Pterodactyl Test Message')
->greeting('Hello ' . $this->user->name . '!')
->greeting('Hello ' . $this->user->username . '!')
->line('This is a test of the Pterodactyl mail system. You\'re good to go!');
}
}

View file

@ -25,7 +25,7 @@ class SubuserObserver
event(new Events\Subuser\Created($subuser));
$subuser->user->notify(new AddedToServer([
'user' => $subuser->user->name_first,
'user' => $subuser->user->username,
'name' => $subuser->server->name,
'uuidShort' => $subuser->server->uuidShort,
]));
@ -47,7 +47,7 @@ class SubuserObserver
event(new Events\Subuser\Deleted($subuser));
$subuser->user->notify(new RemovedFromServer([
'user' => $subuser->user->name_first,
'user' => $subuser->user->username,
'name' => $subuser->server->name,
]));
}

View file

@ -58,8 +58,6 @@ class SubuserCreationService
$user = $this->userCreationService->handle([
'email' => $email,
'username' => $username,
'name_first' => 'Server',
'name_last' => 'Subuser',
'root_admin' => false,
]);
}

View file

@ -25,8 +25,6 @@ class AccountTransformer extends Transformer
'admin' => $model->root_admin,
'username' => $model->username,
'email' => $model->email,
'first_name' => $model->name_first,
'last_name' => $model->name_last,
'language' => $model->language,
];
}