Skip to content

Commit 13718c4

Browse files
authored
Merge pull request #57565 from nextcloud/chore/remove-dead-code
chore(settings): remove dead legacy code
2 parents 4c6981b + ddff2cb commit 13718c4

10 files changed

+172
-216
lines changed

apps/settings/css/settings.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/css/settings.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/css/settings.scss

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -291,61 +291,6 @@ table.nostyle {
291291
}
292292
}
293293

294-
#security-password {
295-
#passwordform {
296-
display: flex;
297-
flex-wrap: wrap;
298-
flex-direction: column;
299-
gap: 1rem;
300-
.input-control {
301-
display: flex;
302-
flex-wrap: wrap;
303-
flex-direction: column;
304-
label {
305-
margin-bottom: 0.5rem;
306-
}
307-
}
308-
309-
#pass1, .personal-show-container {
310-
flex-shrink: 1;
311-
width: 300px;
312-
min-width: 150px;
313-
}
314-
315-
// Extremely fragile code, to be replaced by PasswordField component soon
316-
.personal-show-container {
317-
#pass2 {
318-
position: relative;
319-
top: 0.5rem;
320-
}
321-
.personal-show-label {
322-
top: 34px !important;
323-
margin-inline-end: 0;
324-
margin-top: 0 !important;
325-
inset-inline-end: 3px;
326-
}
327-
}
328-
329-
#pass2 {
330-
width: 100%;
331-
}
332-
333-
.password-state {
334-
display: inline-block;
335-
}
336-
337-
.strengthify-wrapper {
338-
position: absolute;
339-
inset-inline-start: 0;
340-
width: 100%;
341-
border-radius: 0 0 2px 2px;
342-
margin-top: 5px;
343-
overflow: hidden;
344-
height: 3px;
345-
}
346-
}
347-
}
348-
349294
/* Two-Factor Authentication (2FA) */
350295

351296
#two-factor-auth {

apps/settings/js/security_password.js

Lines changed: 0 additions & 84 deletions
This file was deleted.

apps/settings/src/components/PasswordSection.vue

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,86 +2,85 @@
22
- SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
5-
<template>
6-
<NcSettingsSection :name="t('settings', 'Password')">
7-
<form id="passwordform" method="POST" @submit.prevent="changePassword">
8-
<NcPasswordField
9-
id="old-pass"
10-
v-model="oldPass"
11-
:label="t('settings', 'Current password')"
12-
name="oldpassword"
13-
autocomplete="current-password"
14-
autocapitalize="none"
15-
spellcheck="false" />
16-
17-
<NcPasswordField
18-
id="new-pass"
19-
v-model="newPass"
20-
:label="t('settings', 'New password')"
21-
:maxlength="469"
22-
autocomplete="new-password"
23-
autocapitalize="none"
24-
spellcheck="false"
25-
:check-password-strength="true" />
26-
27-
<NcButton
28-
variant="primary"
29-
type="submit"
30-
:disabled="newPass.length === 0 || oldPass.length === 0">
31-
{{ t('settings', 'Change password') }}
32-
</NcButton>
33-
</form>
34-
</NcSettingsSection>
35-
</template>
365

37-
<script>
6+
<script setup lang="ts">
387
import axios from '@nextcloud/axios'
398
import { showError, showSuccess } from '@nextcloud/dialogs'
9+
import { t } from '@nextcloud/l10n'
4010
import { generateUrl } from '@nextcloud/router'
11+
import { NcFormBox } from '@nextcloud/vue'
12+
import { ref } from 'vue'
4113
import NcButton from '@nextcloud/vue/components/NcButton'
4214
import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
4315
import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
4416
45-
export default {
46-
name: 'PasswordSection',
47-
components: {
48-
NcSettingsSection,
49-
NcButton,
50-
NcPasswordField,
51-
},
17+
const passwordform = ref<HTMLFormElement>()
5218
53-
data() {
54-
return {
55-
oldPass: '',
56-
newPass: '',
57-
}
58-
},
19+
const oldPass = ref('')
20+
const newPass = ref('')
5921
60-
methods: {
61-
changePassword() {
62-
axios.post(generateUrl('/settings/personal/changepassword'), {
63-
oldpassword: this.oldPass,
64-
newpassword: this.newPass,
65-
})
66-
.then((res) => res.data)
67-
.then((data) => {
68-
if (data.status === 'error') {
69-
this.errorMessage = data.data.message
70-
showError(data.data.message)
71-
} else {
72-
showSuccess(data.data.message)
73-
}
74-
})
75-
},
76-
},
22+
/**
23+
* Change the user's password
24+
*/
25+
async function changePassword() {
26+
const { data } = await axios.post(generateUrl('/settings/personal/changepassword'), {
27+
oldpassword: oldPass.value,
28+
newpassword: newPass.value,
29+
})
30+
if (data.status === 'error') {
31+
showError(data.data.message)
32+
} else {
33+
showSuccess(data.data.message)
34+
oldPass.value = ''
35+
newPass.value = ''
36+
passwordform.value?.reset()
37+
}
7738
}
7839
</script>
7940

80-
<style>
81-
#passwordform {
82-
display: flex;
83-
flex-direction: column;
84-
gap: 1rem;
85-
max-width: 400px;
86-
}
41+
<template>
42+
<NcSettingsSection :name="t('settings', 'Password')">
43+
<form
44+
ref="passwordform"
45+
:class="$style.passwordSection__form"
46+
@submit.prevent="changePassword">
47+
<NcFormBox>
48+
<NcPasswordField
49+
v-model="oldPass"
50+
:label="t('settings', 'Current password')"
51+
name="oldpassword"
52+
autocomplete="current-password"
53+
autocapitalize="none"
54+
required
55+
spellcheck="false" />
56+
57+
<NcPasswordField
58+
v-model="newPass"
59+
check-password-strength
60+
:label="t('settings', 'New password')"
61+
:maxlength="469"
62+
name="newpassword"
63+
autocomplete="new-password"
64+
autocapitalize="none"
65+
required
66+
spellcheck="false" />
67+
</NcFormBox>
68+
69+
<NcButton
70+
type="submit"
71+
variant="primary"
72+
wide>
73+
{{ t('settings', 'Change password') }}
74+
</NcButton>
75+
</form>
76+
</NcSettingsSection>
77+
</template>
78+
79+
<style module>
80+
.passwordSection__form {
81+
display: flex;
82+
flex-direction: column;
83+
gap: calc(2 * var(--default-grid-baseline));
84+
max-width: 300px !important;
85+
}
8786
</style>

dist/core-common.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)