chore(settings): remove dead legacy code

The `security_password` was last used in the personal setting security
section, but already migrated to vue.
So it can be safely removed.

The styles can also be removed by moving the required ones directly to
the Vue component.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2026-01-15 11:16:24 +01:00
parent 0ff8b35578
commit 04fc1a4418
No known key found for this signature in database
GPG key ID: 7E849AE05218500F
5 changed files with 70 additions and 210 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["settings.scss","../../../core/css/variables.scss","../../../core/css/functions.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA,GCEA;AAAA;AAAA;AAAA,GCFA;AAAA;AAAA;AAAA,GFUC,0BACC,WAKF,OACC,WAID,4BE2BC,2CFvBD,mBEuBC,kDFnBD,qBEmBC,yCFfD,0BEeC,wCFXD,oEEWC,2CFPD,oCACC,oBACA,0BACA,+BACA,mBAGD,4BACC,oBACA,kCAGD,yBACC,WAIA,wCACC,kBACA,yDACC,gBAIA,mOACC,WAKH,uCACC,aAGD,sCACC,WAED,uDACC,WAKD,gBACC,WAIF,mBACC,aACA,aACA,iBACA,uEACA,qBAEA,4BACC,kBACA,SAEA,+BACC,mBAIA,qCACC,iBAKH,kCACC,sBACA,mBACA,gBAGD,mGACC,4BACA,0BACA,WAMF,oBACC,kBACA,wCACC,0BAIF,aACC,oBACA,4CACA,kFACA,8CACA,wCACA,2CACA,8CACA,6CACA,mBACA,yCAEA,sCAEC,oDAGD,+CAEC,6DACA,oDAGD,6BACC,qCACA,WACA,YAIF,6BACC,oBACA,kCAEA,mCACC,WAIA,oCACC,kBACA,oBACA,iBACA,2BACA,WACA,mBACA,QAEA,0CACC,mBACA,uBACA,gBAKD,gIACC,kBACA,qBACA,UACA,oBACA,YAKH,qCACC,kBACA,wBACA,MACA,SAEA,yCACC,qBAIF,4CACC,eAGD,4CACC,sBACA,WACA,YACA,YAMF,qBACC,aACA,sBACA,SACA,YAEA,uBACC,aAGD,uCACC,sBACA,cACA,yBAIF,gBACC,YAIA,2BACC,kCAGD,mBACC,YAIF,sCAEC,aAGD,eACC,WAGD,YACC,qBAIA,aACC,WACA,yBACA,YAGD,WACC,WACA,yBACA,YAMD,oBACC,sBAGD,iBACC,eAKD,iCACC,aACA,eACA,sBACA,SACA,gDACC,aACA,eACA,sBACA,sDACC,oBAIF,kGACC,cACA,YACA,gBAKA,iEACC,kBACA,UAED,+EACC,oBACA,oBACA,wBACA,qBAIF,wCACC,WAGD,iDACC,qBAGD,sDACC,kBACA,qBACA,WACA,0BACA,eACA,gBACA,WAQF,oBACC,gBAGD,wBACC,yBAGD,oDACC,WACA,YACA,wCAOD,oBACC,UACA,cACA,gBACA,uBAGD,2BACC,UAKD,oCAEC,cAKD,wEAEC,aAIF,gBACC,kBACA,QACA,mBAEA,sBACC,YAGD,sBACC,iBAKF,WACC,WAEA,cACC,WACA,UACA,uBACA,4CACA,iBACA,mBAGD,cACC,4CACA,UACA,uBACA,iBACA,mBAKD,gBACC,0BACA,cACA,eACA,uBACA,gBAGD,wBACC,0BAEA,gCACC,kBAIF,sCACC,kBAGD,sDAEC,cACA,eACA,eAEA,0EACC,UACA,qBACA,uBACA,gBAIF,8BACC,eAGD,kCACC,wBACA,cAIF,2BACC,mBAMA,oBACC,mBACA,sBACA,WAGD,gCACC,0BAIA,gGACC,cAOH,SACC,gBAEA,0BACC,4CAID,YACC,oBACA,mBACA,uBACA,eACA,iBACA,gBACA,aAEA,uBACC,aACA,mBACA,uBACA,oCACA,qCACA,yDACA,sBACA,oCAKF,WACC,kBACA,kBACA,oCACA,gBAKF,KACC,mBACA,mBAGD,SACC,aAGD,mBACC,mBAGD,eACC,gBAIA,sBACC,aAGD,YACC,oBAGD,kBACC,0BAGD,yBACC,0BAGD,sBACC,0BAGD,oCACC,uBAIF,yCACC,uBAGD,wBACC,qBAGD,2BACC,wBAEA,gBACA,aACA,yBACA,sBAKD,WACC,kBACA,2BACA,WAGD,2DAGC,qBAIA,mCACC,qBACA,YACA,eAGD,+EAEC,YAIF,yBACC,mCACC,YACA,iBACA,cACA,iDAIF,eACC,WAGD,SACC,yBAGD,QACC,qBACA,YACA,WACA,2BAEA,gBACC,kBAIF,qBACC,sBACA,qBACA,YACA,iBAGD,kBACC,qBACA,gBAIA,aACC,sCACA,mCAGD,WACC,oCAGD,mBACC,sCACA,oBAMF,8CACC,yBACA,YAGD,wBACC,WACA,YACA,mBACA,kBACA,+DAGD,SACC,UAGD,eACC,oCACA,wBAGD,UACI,+CAGJ,2BACE,GACE,YAGJ,mCACE,GACE,WAKH,wBACC,qBACA,eACA,mCACA","file":"settings.css"}
{"version":3,"sourceRoot":"","sources":["settings.scss","../../../core/css/variables.scss","../../../core/css/functions.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA,GCEA;AAAA;AAAA;AAAA,GCFA;AAAA;AAAA;AAAA,GFUC,0BACC,WAKF,OACC,WAID,4BE2BC,2CFvBD,mBEuBC,kDFnBD,qBEmBC,yCFfD,0BEeC,wCFXD,oEEWC,2CFPD,oCACC,oBACA,0BACA,+BACA,mBAGD,4BACC,oBACA,kCAGD,yBACC,WAIA,wCACC,kBACA,yDACC,gBAIA,mOACC,WAKH,uCACC,aAGD,sCACC,WAED,uDACC,WAKD,gBACC,WAIF,mBACC,aACA,aACA,iBACA,uEACA,qBAEA,4BACC,kBACA,SAEA,+BACC,mBAIA,qCACC,iBAKH,kCACC,sBACA,mBACA,gBAGD,mGACC,4BACA,0BACA,WAMF,oBACC,kBACA,wCACC,0BAIF,aACC,oBACA,4CACA,kFACA,8CACA,wCACA,2CACA,8CACA,6CACA,mBACA,yCAEA,sCAEC,oDAGD,+CAEC,6DACA,oDAGD,6BACC,qCACA,WACA,YAIF,6BACC,oBACA,kCAEA,mCACC,WAIA,oCACC,kBACA,oBACA,iBACA,2BACA,WACA,mBACA,QAEA,0CACC,mBACA,uBACA,gBAKD,gIACC,kBACA,qBACA,UACA,oBACA,YAKH,qCACC,kBACA,wBACA,MACA,SAEA,yCACC,qBAIF,4CACC,eAGD,4CACC,sBACA,WACA,YACA,YAMF,qBACC,aACA,sBACA,SACA,YAEA,uBACC,aAGD,uCACC,sBACA,cACA,yBAIF,gBACC,YAIA,2BACC,kCAGD,mBACC,YAIF,sCAEC,aAGD,eACC,WAGD,YACC,qBAIA,aACC,WACA,yBACA,YAGD,WACC,WACA,yBACA,YAMD,oBACC,sBAGD,iBACC,eAOD,oBACC,gBAGD,wBACC,yBAGD,oDACC,WACA,YACA,wCAOD,oBACC,UACA,cACA,gBACA,uBAGD,2BACC,UAKD,oCAEC,cAKD,wEAEC,aAIF,gBACC,kBACA,QACA,mBAEA,sBACC,YAGD,sBACC,iBAKF,WACC,WAEA,cACC,WACA,UACA,uBACA,4CACA,iBACA,mBAGD,cACC,4CACA,UACA,uBACA,iBACA,mBAKD,gBACC,0BACA,cACA,eACA,uBACA,gBAGD,wBACC,0BAEA,gCACC,kBAIF,sCACC,kBAGD,sDAEC,cACA,eACA,eAEA,0EACC,UACA,qBACA,uBACA,gBAIF,8BACC,eAGD,kCACC,wBACA,cAIF,2BACC,mBAMA,oBACC,mBACA,sBACA,WAGD,gCACC,0BAIA,gGACC,cAOH,SACC,gBAEA,0BACC,4CAID,YACC,oBACA,mBACA,uBACA,eACA,iBACA,gBACA,aAEA,uBACC,aACA,mBACA,uBACA,oCACA,qCACA,yDACA,sBACA,oCAKF,WACC,kBACA,kBACA,oCACA,gBAKF,KACC,mBACA,mBAGD,SACC,aAGD,mBACC,mBAGD,eACC,gBAIA,sBACC,aAGD,YACC,oBAGD,kBACC,0BAGD,yBACC,0BAGD,sBACC,0BAGD,oCACC,uBAIF,yCACC,uBAGD,wBACC,qBAGD,2BACC,wBAEA,gBACA,aACA,yBACA,sBAKD,WACC,kBACA,2BACA,WAGD,2DAGC,qBAIA,mCACC,qBACA,YACA,eAGD,+EAEC,YAIF,yBACC,mCACC,YACA,iBACA,cACA,iDAIF,eACC,WAGD,SACC,yBAGD,QACC,qBACA,YACA,WACA,2BAEA,gBACC,kBAIF,qBACC,sBACA,qBACA,YACA,iBAGD,kBACC,qBACA,gBAIA,aACC,sCACA,mCAGD,WACC,oCAGD,mBACC,sCACA,oBAMF,8CACC,yBACA,YAGD,wBACC,WACA,YACA,mBACA,kBACA,+DAGD,SACC,UAGD,eACC,oCACA,wBAGD,UACI,+CAGJ,2BACE,GACE,YAGJ,mCACE,GACE,WAKH,wBACC,qBACA,eACA,mCACA","file":"settings.css"}

View file

@ -291,61 +291,6 @@ table.nostyle {
}
}
#security-password {
#passwordform {
display: flex;
flex-wrap: wrap;
flex-direction: column;
gap: 1rem;
.input-control {
display: flex;
flex-wrap: wrap;
flex-direction: column;
label {
margin-bottom: 0.5rem;
}
}
#pass1, .personal-show-container {
flex-shrink: 1;
width: 300px;
min-width: 150px;
}
// Extremely fragile code, to be replaced by PasswordField component soon
.personal-show-container {
#pass2 {
position: relative;
top: 0.5rem;
}
.personal-show-label {
top: 34px !important;
margin-inline-end: 0;
margin-top: 0 !important;
inset-inline-end: 3px;
}
}
#pass2 {
width: 100%;
}
.password-state {
display: inline-block;
}
.strengthify-wrapper {
position: absolute;
inset-inline-start: 0;
width: 100%;
border-radius: 0 0 2px 2px;
margin-top: 5px;
overflow: hidden;
height: 3px;
}
}
}
/* Two-Factor Authentication (2FA) */
#two-factor-auth {

View file

@ -1,84 +0,0 @@
/* global OC */
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2011-2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
window.addEventListener('DOMContentLoaded', function() {
if ($('#pass2').length) {
$('#pass2').showPassword().keyup()
}
const removeloader = function() {
setTimeout(function() {
if ($('.password-state').length > 0) {
$('.password-state').remove()
}
}, 5000)
}
$('#passwordbutton').click(function() {
if ($('#pass1').val() !== '' && $('#pass2').val() !== '') {
// Serialize the data
const post = $('#passwordform').serialize()
$('#passwordchanged').hide()
$('#passworderror').hide()
$('#passwordbutton').attr('disabled', 'disabled')
$('#passwordbutton').after("<span class='password-loading icon icon-loading-small-dark password-state'></span>")
$('.personal-show-label').hide()
// Ajax foo
$.post(OC.generateUrl('/settings/personal/changepassword'), post, function(data) {
if (data.status === 'success') {
$('#passwordbutton').after("<span class='checkmark icon icon-checkmark password-state'></span>")
removeloader()
$('#pass1').val('')
$('#pass2').val('').change()
}
if (typeof (data.data) !== 'undefined') {
OC.msg.finishedSaving('#password-error-msg', data)
} else {
OC.msg.finishedSaving(
'#password-error-msg',
{
status: 'error',
data: {
message: t('settings', 'Unable to change password'),
},
},
)
}
$('.personal-show-label').show()
$('.password-loading').remove()
$('#passwordbutton').removeAttr('disabled')
})
return false
} else {
OC.msg.finishedSaving(
'#password-error-msg',
{
status: 'error',
data: {
message: t('settings', 'Unable to change password'),
},
},
)
return false
}
})
$('#pass2').strengthify({
zxcvbn: OC.linkTo('core', 'vendor/zxcvbn/dist/zxcvbn.js'),
titles: [
t('settings', 'Very weak password'),
t('settings', 'Weak password'),
t('settings', 'So-so password'),
t('settings', 'Good password'),
t('settings', 'Strong password'),
],
drawTitles: true,
$addAfter: $('input[name="newpassword-clone"]'),
nonce: btoa(OC.requestToken),
})
})

View file

@ -2,86 +2,85 @@
- SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import axios from '@nextcloud/axios'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import { NcFormBox } from '@nextcloud/vue'
import { ref } from 'vue'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
const passwordform = ref<HTMLFormElement>()
const oldPass = ref('')
const newPass = ref('')
/**
* Change the user's password
*/
async function changePassword() {
const { data } = await axios.post(generateUrl('/settings/personal/changepassword'), {
oldpassword: oldPass.value,
newpassword: newPass.value,
})
if (data.status === 'error') {
showError(data.data.message)
} else {
showSuccess(data.data.message)
oldPass.value = ''
newPass.value = ''
passwordform.value?.reset()
}
}
</script>
<template>
<NcSettingsSection :name="t('settings', 'Password')">
<form id="passwordform" method="POST" @submit.prevent="changePassword">
<NcPasswordField
id="old-pass"
v-model="oldPass"
:label="t('settings', 'Current password')"
name="oldpassword"
autocomplete="current-password"
autocapitalize="none"
spellcheck="false" />
<form
ref="passwordform"
:class="$style.passwordSection__form"
@submit.prevent="changePassword">
<NcFormBox>
<NcPasswordField
v-model="oldPass"
:label="t('settings', 'Current password')"
name="oldpassword"
autocomplete="current-password"
autocapitalize="none"
required
spellcheck="false" />
<NcPasswordField
id="new-pass"
v-model="newPass"
:label="t('settings', 'New password')"
:maxlength="469"
autocomplete="new-password"
autocapitalize="none"
spellcheck="false"
:check-password-strength="true" />
<NcPasswordField
v-model="newPass"
check-password-strength
:label="t('settings', 'New password')"
:maxlength="469"
name="newpassword"
autocomplete="new-password"
autocapitalize="none"
required
spellcheck="false" />
</NcFormBox>
<NcButton
variant="primary"
type="submit"
:disabled="newPass.length === 0 || oldPass.length === 0">
variant="primary"
wide>
{{ t('settings', 'Change password') }}
</NcButton>
</form>
</NcSettingsSection>
</template>
<script>
import axios from '@nextcloud/axios'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { generateUrl } from '@nextcloud/router'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
export default {
name: 'PasswordSection',
components: {
NcSettingsSection,
NcButton,
NcPasswordField,
},
data() {
return {
oldPass: '',
newPass: '',
}
},
methods: {
changePassword() {
axios.post(generateUrl('/settings/personal/changepassword'), {
oldpassword: this.oldPass,
newpassword: this.newPass,
})
.then((res) => res.data)
.then((data) => {
if (data.status === 'error') {
this.errorMessage = data.data.message
showError(data.data.message)
} else {
showSuccess(data.data.message)
}
})
},
},
<style module>
.passwordSection__form {
display: flex;
flex-direction: column;
gap: calc(2 * var(--default-grid-baseline));
max-width: 300px !important;
}
</script>
<style>
#passwordform {
display: flex;
flex-direction: column;
gap: 1rem;
max-width: 400px;
}
</style>