1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

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()) { if ($this->input->isInteractive()) {
$tableValues = []; $tableValues = [];
foreach ($results as $user) { 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'))) { if (!$deleteUser = $this->ask(trans('command/messages.user.select_search_user'))) {
return $this->handle(); 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')); $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')); $email = $this->option('email') ?? $this->ask(trans('command/messages.user.ask_email'));
$username = $this->option('username') ?? $this->ask(trans('command/messages.user.ask_username')); $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')) { if (is_null($password = $this->option('password')) && !$this->option('no-password')) {
$this->warn(trans('command/messages.user.ask_password_help')); $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')); $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'], [ $this->table(['Field', 'Value'], [
['UUID', $user->uuid], ['UUID', $user->uuid],
['Email', $user->email], ['Email', $user->email],
['Username', $user->username], ['Username', $user->username],
['Name', $user->name],
['Admin', $user->root_admin ? 'Yes' : 'No'], ['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\Support\Carbon|null $updated_at
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ApiKey[] $apiKeys * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\ApiKey[] $apiKeys
* @property int|null $api_keys_count * @property int|null $api_keys_count
* @property string $name
* @property \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications * @property \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property int|null $notifications_count * @property int|null $notifications_count
* @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\RecoveryToken[] $recoveryTokens * @property \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\RecoveryToken[] $recoveryTokens
@ -223,14 +222,6 @@ class User extends Model implements
$this->attributes['username'] = mb_strtolower($value); $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 public function avatarURL(): string
{ {
return 'https://www.gravatar.com/avatar/' . md5($this->email) . '.jpg'; 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 public function toMail(): MailMessage
{ {
$message = (new 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('You are receiving this email because an account has been created for you on ' . config('app.name') . '.')
->line('Username: ' . $this->user->username) ->line('Username: ' . $this->user->username)
->line('Email: ' . $this->user->email); ->line('Email: ' . $this->user->email);

View File

@ -21,7 +21,7 @@ class MailTested extends Notification
{ {
return (new MailMessage()) return (new MailMessage())
->subject('Pterodactyl Test Message') ->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!'); ->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)); event(new Events\Subuser\Created($subuser));
$subuser->user->notify(new AddedToServer([ $subuser->user->notify(new AddedToServer([
'user' => $subuser->user->name_first, 'user' => $subuser->user->username,
'name' => $subuser->server->name, 'name' => $subuser->server->name,
'uuidShort' => $subuser->server->uuidShort, 'uuidShort' => $subuser->server->uuidShort,
])); ]));
@ -47,7 +47,7 @@ class SubuserObserver
event(new Events\Subuser\Deleted($subuser)); event(new Events\Subuser\Deleted($subuser));
$subuser->user->notify(new RemovedFromServer([ $subuser->user->notify(new RemovedFromServer([
'user' => $subuser->user->name_first, 'user' => $subuser->user->username,
'name' => $subuser->server->name, 'name' => $subuser->server->name,
])); ]));
} }

View File

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

View File

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