change password and others abstracts methods
This commit is contained in:
parent
81347af721
commit
2e001ccfba
1 changed files with 50 additions and 0 deletions
|
@ -293,4 +293,54 @@ class Server_Manager_Mailcow extends Server_Manager
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change account username on server.
|
||||
*/
|
||||
public function changeAccountUsername(Server_Account $a, $new): never
|
||||
{
|
||||
throw new Server_Exception(':type: does not support :action:', [':type:' => 'Mailcow', ':action:' => __trans('username changes')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change account domain on server.
|
||||
*/
|
||||
public function changeAccountDomain(Server_Account $a, $new): never
|
||||
{
|
||||
throw new Server_Exception(':type: does not support :action:', [':type:' => 'Mailcow', ':action:' => __trans('changing the account domain')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change account password on server.
|
||||
*/
|
||||
public function changeAccountPassword(Server_Account $a, $new)
|
||||
{
|
||||
$domainAdminData = [
|
||||
'json' => [
|
||||
|
||||
"items" => [
|
||||
"adm_" . str_replace(".", "", $a->getDomain())
|
||||
],
|
||||
"attr" => [
|
||||
"password" => $new,
|
||||
"password2" => $new
|
||||
]
|
||||
]
|
||||
// Make request and change password
|
||||
$result = $this->_makeRequest('POST', 'edit/domain-admin', $domainAdminData);
|
||||
if (! str_contains($result, 'success')) {
|
||||
$placeholders = [':action:' => __trans('change account password'), ':type:' => 'Mailcow'];
|
||||
|
||||
throw new Server_Exception('Failed to :action: on the :type: server, check the error logs for further details', $placeholders);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change account IP on server.
|
||||
*/
|
||||
public function changeAccountIp(Server_Account $a, $new): never
|
||||
{
|
||||
throw new Server_Exception(':type: does not support :action:', [':type:' => 'Mailcow', ':action:' => __trans('changing the account IP')]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue