mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 14:44:13 +00:00
client: fix password change input
The TS rewrite dropped the form that was expected to be passed as props. That lead to the password change being borked, as the fields were always set to "null". We don't need a form, can just use refs here.
This commit is contained in:
parent
e05871fd2f
commit
8f08cf3d0b
1 changed files with 14 additions and 12 deletions
|
@ -15,6 +15,7 @@
|
|||
<RevealPassword v-slot:default="slotProps">
|
||||
<input
|
||||
id="current-password"
|
||||
v-model="old_password"
|
||||
autocomplete="current-password"
|
||||
:type="slotProps.isVisible ? 'text' : 'password'"
|
||||
name="old_password"
|
||||
|
@ -28,6 +29,7 @@
|
|||
<RevealPassword v-slot:default="slotProps">
|
||||
<input
|
||||
id="new-password"
|
||||
v-model="new_password"
|
||||
:type="slotProps.isVisible ? 'text' : 'password'"
|
||||
name="new_password"
|
||||
autocomplete="new-password"
|
||||
|
@ -41,6 +43,7 @@
|
|||
<RevealPassword v-slot:default="slotProps">
|
||||
<input
|
||||
id="new-password-verify"
|
||||
v-model="verify_password"
|
||||
:type="slotProps.isVisible ? 'text' : 'password'"
|
||||
name="verify_password"
|
||||
autocomplete="new-password"
|
||||
|
@ -111,13 +114,7 @@ export default defineComponent({
|
|||
RevealPassword,
|
||||
Session,
|
||||
},
|
||||
props: {
|
||||
settingsForm: {
|
||||
type: Object as PropType<HTMLFormElement>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
setup() {
|
||||
const store = useStore();
|
||||
|
||||
const passwordErrors = {
|
||||
|
@ -132,6 +129,10 @@ export default defineComponent({
|
|||
error: keyof typeof passwordErrors;
|
||||
}>();
|
||||
|
||||
const old_password = ref("");
|
||||
const new_password = ref("");
|
||||
const verify_password = ref("");
|
||||
|
||||
const currentSession = computed(() => {
|
||||
return store.state.sessions.find((item) => item.current);
|
||||
});
|
||||
|
@ -149,12 +150,10 @@ export default defineComponent({
|
|||
});
|
||||
|
||||
const changePassword = () => {
|
||||
const allFields = new FormData(props.settingsForm);
|
||||
|
||||
const data = {
|
||||
old_password: allFields.get("old_password"),
|
||||
new_password: allFields.get("new_password"),
|
||||
verify_password: allFields.get("verify_password"),
|
||||
old_password: old_password.value,
|
||||
new_password: new_password.value,
|
||||
verify_password: verify_password.value,
|
||||
};
|
||||
|
||||
if (!data.old_password || !data.new_password || !data.verify_password) {
|
||||
|
@ -189,6 +188,9 @@ export default defineComponent({
|
|||
activeSessions,
|
||||
otherSessions,
|
||||
changePassword,
|
||||
old_password,
|
||||
new_password,
|
||||
verify_password,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue