Skip to content

Commit

Permalink
Fix can't unset ssh key
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwang401 committed Oct 24, 2022
1 parent 790ce4a commit 0d51e86
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ This file is a running track of new features and fixes to each version of the pa

This project follows [Semantic Versioning](http://semver.org) guidelines.

## v2.0.1-beta
### Fixed
* Problem where validation errors for the SSH key wouldn't show up
* Bug where user couldn't unset a SSH key after saving one

## v2.0.0-beta (Bombay)
### Added
* Storing of CPU, memory, disk, snapshots, backups, and bandwidth limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public function rules()
];

if ($this->request->get('type') === 'sshkeys') {
$rules['contents'] = ['required_if:type,sshkeys'];
$rules['contents'] = ['present', 'nullable', 'string', 'max:800'];
}
if ($this->request->get('type') === 'cipassword') {
$rules['password'] = ['confirmed', 'min:10', 'required_if:type,cipassword'];
$rules['password'] = ['confirmed', 'min:10', 'max:191', 'required'];
}

return $rules;
Expand Down
8 changes: 6 additions & 2 deletions app/Services/Servers/CloudinitService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ public function __construct(protected ProxmoxCloudinitRepository $repository)
* @param array $params
* @return mixed
*/
public function changePassword(string $password, AuthenticationType $type)
public function changePassword(?string $password, AuthenticationType $type)
{
$this->repository->setServer($this->server);

if (AuthenticationType::KEY === $type) {
return $this->repository->update([$type->value => rawurlencode($password)]);
if (!empty($password)) {
return $this->repository->update([$type->value => rawurlencode($password)]);
} else {
$this->repository->update(['delete' => $type->value]);
}
} else {
return $this->repository->update([$type->value => $password]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const PasswordConfigSettings = () => {
error={errors.contents}
autosize
maxRows={4}
required
/>
)}

Expand Down

0 comments on commit 0d51e86

Please sign in to comment.