Skip to content

Commit 53b0900

Browse files
authored
Merge pull request #739 from nextcloud/pr-592
feat(updater.secret): allow users to just copy paste the line
2 parents 40933c5 + 36a86fb commit 53b0900

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

index.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,15 @@ public function isAuthenticated(): bool {
20242024
<p>To login you need to provide the unhashed value of "updater.secret" in your config file.</p>
20252025
<p>If you don't know that value, you can access this updater directly via the Nextcloud admin screen or generate
20262026
your own secret:</p>
2027-
<code>php -r '$password = trim(shell_exec("openssl rand -base64 48"));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";}else{echo "Could not execute OpenSSL.\n";};'</code>
2027+
<code>php -r '$password = trim(shell_exec("openssl rand -base64 48"));
2028+
if (strlen($password) === 64) {
2029+
$hash = password_hash($password, PASSWORD_DEFAULT);
2030+
echo "Insert this line in your config.php:\n\n";
2031+
echo "'\''updater.secret'\'' => '\''" . $hash . "'\'',\n\n";
2032+
echo "The plaintext value is: " . $password . "\n";
2033+
} else {
2034+
echo "Could not execute OpenSSL.\n";
2035+
}'</code>
20282036
<form method="post" name="login">
20292037
<fieldset>
20302038
<input type="password" name="updater-secret-input" value=""

index.web.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,15 @@ public function isAuthenticated(): bool {
576576
<p>To login you need to provide the unhashed value of "updater.secret" in your config file.</p>
577577
<p>If you don't know that value, you can access this updater directly via the Nextcloud admin screen or generate
578578
your own secret:</p>
579-
<code>php -r '$password = trim(shell_exec("openssl rand -base64 48"));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . "\n"; echo "Insert as \"updater.secret\": ".$hash; echo "The plaintext value is: ".$password."\n";}else{echo "Could not execute OpenSSL.\n";};'</code>
579+
<code>php -r '$password = trim(shell_exec("openssl rand -base64 48"));
580+
if (strlen($password) === 64) {
581+
$hash = password_hash($password, PASSWORD_DEFAULT);
582+
echo "Insert this line in your config.php:\n\n";
583+
echo "'\''updater.secret'\'' => '\''" . $hash . "'\'',\n\n";
584+
echo "The plaintext value is: " . $password . "\n";
585+
} else {
586+
echo "Could not execute OpenSSL.\n";
587+
}'</code>
580588
<form method="post" name="login">
581589
<fieldset>
582590
<input type="password" name="updater-secret-input" value=""

0 commit comments

Comments
 (0)