mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
allow to change the password
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
b929d57a77
commit
c8854ab1e3
3 changed files with 69 additions and 25 deletions
|
|
@ -25,6 +25,12 @@ class ConfigurationController
|
||||||
$this->configurationManager->SetDomain($request->getParsedBody()['domain']);
|
$this->configurationManager->SetDomain($request->getParsedBody()['domain']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($request->getParsedBody()['current-master-password']) || isset($request->getParsedBody()['new-master-password'])) {
|
||||||
|
$currentMasterPassword = $request->getParsedBody()['current-master-password'] ?? '';
|
||||||
|
$newMasterPassword = $request->getParsedBody()['new-master-password'] ?? '';
|
||||||
|
$this->configurationManager->ChangeMasterPassword($currentMasterPassword, $newMasterPassword);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($request->getParsedBody()['borg_backup_host_location'])) {
|
if (isset($request->getParsedBody()['borg_backup_host_location'])) {
|
||||||
$this->configurationManager->SetBorgBackupHostLocation($request->getParsedBody()['borg_backup_host_location']);
|
$this->configurationManager->SetBorgBackupHostLocation($request->getParsedBody()['borg_backup_host_location']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,34 @@ class ConfigurationManager
|
||||||
$this->WriteConfig($config);
|
$this->WriteConfig($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws InvalidSettingConfigurationException
|
||||||
|
*/
|
||||||
|
public function ChangeMasterPassword(string $currentPassword, string $newPassword) : void {
|
||||||
|
if ($currentPassword === '') {
|
||||||
|
throw new InvalidSettingConfigurationException("Please enter your current password.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($currentPassword !== $this->GetPassword()) {
|
||||||
|
throw new InvalidSettingConfigurationException("The entered current password is not correct.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($newPassword === '') {
|
||||||
|
throw new InvalidSettingConfigurationException("Please enter a new password.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($newPassword) < 24) {
|
||||||
|
throw new InvalidSettingConfigurationException("New passwords must be >= 24 digits.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match("#^[a-zA-Z0-9 ]+$#", $newPassword)) {
|
||||||
|
throw new InvalidSettingConfigurationException('Not allowed characters in the new password.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// All checks pass so set the password
|
||||||
|
$this->SetPassword($newPassword);
|
||||||
|
}
|
||||||
|
|
||||||
public function GetApachePort() : string {
|
public function GetApachePort() : string {
|
||||||
$port = getenv('APACHE_PORT');
|
$port = getenv('APACHE_PORT');
|
||||||
if ($port === false) {
|
if ($port === false) {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@
|
||||||
<h1>Nextcloud AIO Beta v0.6.0</h1>
|
<h1>Nextcloud AIO Beta v0.6.0</h1>
|
||||||
This is beta software and not production ready.<br><br>
|
This is beta software and not production ready.<br><br>
|
||||||
|
|
||||||
You are currently running the {{ current_channel }} channel.<br><br>
|
|
||||||
|
|
||||||
{% set isAnyRunning = false %}
|
{% set isAnyRunning = false %}
|
||||||
{% set isWatchtowerRunning = false %}
|
{% set isWatchtowerRunning = false %}
|
||||||
{% set isBackupContainerRunning = false %}
|
{% set isBackupContainerRunning = false %}
|
||||||
|
|
@ -79,6 +77,7 @@
|
||||||
|
|
||||||
{% if isAnyRunning == true %}
|
{% if isAnyRunning == true %}
|
||||||
{% if isApacheStarting != true %}
|
{% if isApacheStarting != true %}
|
||||||
|
Your initial Nextcloud credentials:<br><br />
|
||||||
Initial Nextcloud username: admin<br />
|
Initial Nextcloud username: admin<br />
|
||||||
Initial Nextcloud password: {{ nextcloud_password }}<br /><br/>
|
Initial Nextcloud password: {{ nextcloud_password }}<br /><br/>
|
||||||
<a href="https://{{ domain }}" class="button" target="_blank" rel="noopener">Open your Nextcloud ↗</a><br/>
|
<a href="https://{{ domain }}" class="button" target="_blank" rel="noopener">Open your Nextcloud ↗</a><br/>
|
||||||
|
|
@ -161,9 +160,13 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if is_mastercontainer_update_available == true %}
|
{% if was_start_button_clicked == true %}
|
||||||
|
|
||||||
{% if isBackupOrRestoreRunning == false %}
|
{% if isBackupOrRestoreRunning == false %}
|
||||||
<h2>Mastercontainer update</h2>
|
<h2>Mastercontainer</h2>
|
||||||
|
You are currently running the {{ current_channel }} channel.<br><br>
|
||||||
|
|
||||||
|
{% if is_mastercontainer_update_available == true %}
|
||||||
{% if isAnyRunning == false %}
|
{% if isAnyRunning == false %}
|
||||||
⚠ A mastercontainer update is available. Please click on the button below to update it.<br><br>
|
⚠ A mastercontainer update is available. Please click on the button below to update it.<br><br>
|
||||||
<form method="POST" action="/api/docker/watchtower" class="xhr">
|
<form method="POST" action="/api/docker/watchtower" class="xhr">
|
||||||
|
|
@ -182,11 +185,18 @@
|
||||||
You can find all changes <a href="https://github.com/nextcloud-releases/all-in-one/commits/main">here</a><br><br>
|
You can find all changes <a href="https://github.com/nextcloud-releases/all-in-one/commits/main">here</a><br><br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
You can change your AIO password below:<br><br />
|
||||||
|
<form method="POST" action="/api/configuration" class="xhr">
|
||||||
|
<input type="text" autocomplete="current-password" name="current-master-password" placeholder="your current aio password"/>
|
||||||
|
<input type="text" autocomplete="new-password" name="new-master-password" placeholder="your new aio password"/>
|
||||||
|
<input type="hidden" name="{{csrf.keys.name}}" value="{{csrf.name}}">
|
||||||
|
<input type="hidden" name="{{csrf.keys.value}}" value="{{csrf.value}}">
|
||||||
|
<input class="button" type="submit" value="Submit" />
|
||||||
|
</form>
|
||||||
|
The new password needs to be at least 24 characters long. Allowed characters are the <a href="https://en.wikipedia.org/wiki/Latin_alphabet#/media/File:Abecedarium.png">latin characters</a> 'a-z', 'A-Z', '0-9' and spaces.<br><br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if was_start_button_clicked == true %}
|
|
||||||
|
|
||||||
|
|
||||||
{% if isBackupOrRestoreRunning == false and borg_backup_host_location == "" and isApacheStarting != true %}
|
{% if isBackupOrRestoreRunning == false and borg_backup_host_location == "" and isApacheStarting != true %}
|
||||||
<h2>Backup and restore</h2>
|
<h2>Backup and restore</h2>
|
||||||
Please type in the directory where backups will get created on the host system:<br><br>
|
Please type in the directory where backups will get created on the host system:<br><br>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue