Update pankow to enable email change dialogs
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
<tr>
|
||||
<td class="text-muted" style="vertical-align: top;">{{ $t('main.displayName') }}</td>
|
||||
<td class="text-right" style="vertical-align: top; white-space: nowrap;">
|
||||
{{ user.displayName }} <Button small tool outline @click="onChangeDisplayName(user.displayName)" v-show="!user.source && !config.profileLocked" icon="fa fa-edit text-small"></Button>
|
||||
{{ user.displayName }} <Button small tool outline @click="onChangeDisplayName(user.displayName)" v-show="!user.source && !config.profileLocked" icon="fa fa-edit text-small" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-muted" style="vertical-align: top;">{{ $t('profile.primaryEmail') }}</td>
|
||||
<td class="text-right" style="vertical-align: top; white-space: nowrap;">
|
||||
{{ user.email }} <a href="" ng-click="emailChange.show()" ng-hide="user.source || config.profileLocked"><i class="fa fa-edit text-small"></i></a>
|
||||
{{ user.email }} <Button small tool outline @click="onChangeEmail(user.email)" v-show="!user.source && !config.profileLocked" icon="fa fa-edit text-small" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -111,15 +111,15 @@ async function onSelectLanguage(lang) {
|
||||
|
||||
async function onChangeDisplayName(currentDisplayName) {
|
||||
const displayName = await inputDialog.value.prompt({
|
||||
message: 'Display Name',
|
||||
message: t('profile.changeDisplayName.title'),
|
||||
modal: false,
|
||||
value: currentDisplayName,
|
||||
confirmStyle: 'success',
|
||||
confirmLabel: 'Save',
|
||||
rejectLabel: 'Close'
|
||||
confirmLabel: t('main.dialog.save'),
|
||||
rejectLabel: t('main.dialog.cancel')
|
||||
});
|
||||
|
||||
if (!displayName) return;
|
||||
if (!displayName || currentDisplayName === displayName) return;
|
||||
|
||||
const error = await profileModel.setDisplayName(displayName);
|
||||
if (error) return console.error('Failed to set displayName', error);
|
||||
@@ -127,6 +127,25 @@ async function onChangeDisplayName(currentDisplayName) {
|
||||
user.value = await profileModel.get();
|
||||
}
|
||||
|
||||
async function onChangeEmail(currentEmail) {
|
||||
const result = await inputDialog.value.prompt({
|
||||
message: [ t('profile.changeEmail.title'), t('profile.changeEmail.password') ],
|
||||
type: [ 'email', 'password' ],
|
||||
modal: false,
|
||||
value: [ currentEmail, '' ],
|
||||
confirmStyle: 'success',
|
||||
confirmLabel: t('main.dialog.save'),
|
||||
rejectLabel: t('main.dialog.cancel')
|
||||
});
|
||||
|
||||
if (!result || !result[0] || !result[1] || currentEmail === result[0]) return;
|
||||
|
||||
const error = await profileModel.setEmail(result[0], result[1]);
|
||||
if (error) return console.error('Failed to set email', error);
|
||||
|
||||
user.value = await profileModel.get();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user