Skip to content

Commit

Permalink
add password confirmation in admin settings
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Sep 12, 2024
1 parent bcb7070 commit a8859a1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\IConfig;

Expand Down Expand Up @@ -76,6 +77,7 @@ public function setConfig(array $values): DataResponse {
* @param array<string,string> $values
* @return DataResponse
*/
#[PasswordConfirmationRequired]
public function setAdminConfig(array $values): DataResponse {
foreach ($values as $key => $value) {
$this->config->setAppValue(Application::APP_ID, $key, $value);
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@nextcloud/initial-state": "^2.2.0",
"@nextcloud/l10n": "^3.1.0",
"@nextcloud/moment": "^1.3.1",
"@nextcloud/password-confirmation": "^5.1.1",
"@nextcloud/router": "^3.0.1",
"@nextcloud/vue": "^8.18.0",
"vue": "^2.6.11",
Expand Down
4 changes: 3 additions & 1 deletion src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { delay } from '../utils.js'
import { showSuccess, showError } from '@nextcloud/dialogs'
import { confirmPassword } from '@nextcloud/password-confirmation'
export default {
name: 'AdminSettings',
Expand Down Expand Up @@ -97,7 +98,8 @@ export default {
this.saveOptions()
}, 2000)()
},
saveOptions() {
async saveOptions() {
await confirmPassword()
const req = {
values: {
client_id: this.state.client_id,
Expand Down

0 comments on commit a8859a1

Please sign in to comment.