Resolve "Set Password should be changed to Change Password once the user has set the password on User Profile screen"

This commit is contained in:
N Pex 2023-06-07 12:55:12 +00:00
parent 026a422230
commit 7b3b167afe
5 changed files with 17 additions and 48 deletions

View file

@ -428,10 +428,7 @@ export default {
console.log(
"CreateRoom: Set display name to: " + this.selectedProfile.name
);
return this.$matrix.matrixClient.setDisplayName(
this.selectedProfile.name,
undefined
);
return this.$matrix.setUserDisplayName(this.selectedProfile.name);
}
}.bind(this)
)

View file

@ -371,7 +371,7 @@ export default {
return Promise.resolve(user);
} else {
console.log("Join: Set display name to: " + this.selectedProfile.name);
return this.$matrix.matrixClient.setDisplayName(this.selectedProfile.name, undefined);
return this.$matrix.setUserDisplayName(this.selectedProfile.name);
}
}.bind(this)
)

View file

@ -69,7 +69,7 @@
<ActionRow
@click="showEditPasswordDialog = true"
:icon="'$vuetify.icons.password'"
:text="$t('profile.set_password')"
:text="$matrix.currentUser.is_guest ? $t('profile.set_password') : $t('profile.change_password')"
/>
<ActionRow
@click="
@ -93,7 +93,7 @@
:width="$vuetify.breakpoint.smAndUp ? '940px' : '80%'"
>
<v-card :disabled="settingPassword">
<v-card-title>{{ $t("profile.change_password") }}</v-card-title>
<v-card-title>{{ $matrix.currentUser.is_guest ? $t("profile.set_password") : $t("profile.change_password") }}</v-card-title>
<v-card-text>
<v-text-field
v-if="!$matrix.currentUser.is_guest"
@ -232,42 +232,6 @@ export default {
},
computed: {
user() {
if (!this.$matrix.matrixClient) {
return null;
}
return this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);
},
displayName() {
if (!this.user) {
return null;
}
return this.user.displayName || this.user.userId;
},
userAvatar() {
if (!this.user || !this.user.avatarUrl) {
return null;
}
return this.$matrix.matrixClient.mxcUrlToHttp(
this.user.avatarUrl,
80,
80,
"scale",
true
);
},
userAvatarLetter() {
if (!this.user) {
return null;
}
return (this.user.displayName || this.user.userId.substring(1))
.substring(0, 1)
.toUpperCase();
},
passwordsMatch() {
return (
!this.newPasswordHasError &&

View file

@ -12,7 +12,7 @@ export default {
if (!this.user) {
return null;
}
return this.user.displayName;
return this.$matrix.userDisplayName || this.user.displayName;
},
set(newValue) {
this.user.displayName = newValue
@ -20,17 +20,17 @@ export default {
},
userAvatar() {
if (!this.user || !this.user.avatarUrl) {
if (!this.$matrix.userAvatar) {
return null;
}
return this.$matrix.matrixClient.mxcUrlToHttp(this.user.avatarUrl, 80, 80, 'scale', true);
return this.$matrix.matrixClient.mxcUrlToHttp(this.$matrix.userAvatar, 80, 80, 'scale', true);
},
userAvatarLetter() {
if (!this.user) {
return null;
}
return (this.user.displayName || this.user.userId.substring(1)).substring(0, 1).toUpperCase();
return (this.$matrix.userDisplayName || this.user.displayName || this.user.userId.substring(1)).substring(0, 1).toUpperCase();
},
passwordsMatch() {
@ -46,7 +46,7 @@ export default {
})
},
updateDisplayName(name) {
this.$matrix.matrixClient.setDisplayName(name || this.user.userId);
this.$matrix.setUserDisplayName(name || this.user.userId);
}
}
}

View file

@ -946,6 +946,14 @@ export default {
}
},
setUserDisplayName(name) {
if (this.matrixClient) {
return this.matrixClient.setDisplayName(name || this.user.userId).then(() => this.userDisplayName = name).catch(err => console.err("Failed to set display name", err));
} else {
return Promise.reject("No matrix client");
}
},
setPassword(oldPassword, newPassword) {
if (this.matrixClient && this.currentUser) {
const authDict = {