Commit 0e403604 authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Add reset password dialog to user's page

parent ad2d487b
Pipeline #22336 passed with stages
in 8 minutes and 34 seconds
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
}, },
methods: { methods: {
getPasswordResetToken(nickname) { getPasswordResetToken(nickname) {
this.resetPasswordDialogOpen = true this.$emit('open-reset-token-dialog')
this.$store.dispatch('GetPasswordResetToken', nickname) this.$store.dispatch('GetPasswordResetToken', nickname)
}, },
handleConfirmationResend(user) { handleConfirmationResend(user) {
......
...@@ -66,7 +66,10 @@ ...@@ -66,7 +66,10 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('users.actions')" fixed="right"> <el-table-column :label="$t('users.actions')" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<moderation-dropdown :user="scope.row" :page="'users'"/> <moderation-dropdown
:user="scope.row"
:page="'users'"
@open-reset-token-dialog="openResetPasswordDialog"/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -170,6 +173,10 @@ export default { ...@@ -170,6 +173,10 @@ export default {
clearSelection() { clearSelection() {
this.$refs.usersTable.clearSelection() this.$refs.usersTable.clearSelection()
}, },
closeResetPasswordDialog() {
this.resetPasswordDialogOpen = false
this.$store.dispatch('RemovePasswordToken')
},
async createNewAccount(accountData) { async createNewAccount(accountData) {
await this.$store.dispatch('CreateNewAccount', accountData) await this.$store.dispatch('CreateNewAccount', accountData)
this.createAccountDialogOpen = false this.createAccountDialogOpen = false
...@@ -188,9 +195,8 @@ export default { ...@@ -188,9 +195,8 @@ export default {
handleSelectionChange(value) { handleSelectionChange(value) {
this.$data.selectedUsers = value this.$data.selectedUsers = value
}, },
closeResetPasswordDialog() { openResetPasswordDialog() {
this.resetPasswordDialogOpen = false this.resetPasswordDialogOpen = true
this.$store.dispatch('RemovePasswordToken')
}, },
showDeactivatedButton(id) { showDeactivatedButton(id) {
return this.$store.state.user.id !== id return this.$store.state.user.id !== id
......
...@@ -5,8 +5,24 @@ ...@@ -5,8 +5,24 @@
<el-avatar :src="user.avatar" size="large" /> <el-avatar :src="user.avatar" size="large" />
<h1>{{ user.display_name }}</h1> <h1>{{ user.display_name }}</h1>
</div> </div>
<moderation-dropdown :user="user" :page="'userPage'"/> <moderation-dropdown
:user="user"
:page="'userPage'"
@open-reset-token-dialog="openResetPasswordDialog"/>
</header> </header>
<el-dialog
v-loading="loading"
:visible.sync="resetPasswordDialogOpen"
:title="$t('users.passwordResetTokenCreated')"
custom-class="password-reset-token-dialog"
@close="closeResetPasswordDialog">
<div>
<p class="password-reset-token">Password reset token was generated: {{ passwordResetToken }}</p>
<p>You can also use this link to reset password:
<a :href="passwordResetLink" target="_blank" class="reset-password-link">{{ passwordResetLink }}</a>
</p>
</div>
</el-dialog>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-card class="user-profile-card"> <el-card class="user-profile-card">
...@@ -94,10 +110,20 @@ export default { ...@@ -94,10 +110,20 @@ export default {
components: { ModerationDropdown, Status }, components: { ModerationDropdown, Status },
data() { data() {
return { return {
showPrivate: false showPrivate: false,
resetPasswordDialogOpen: false
} }
}, },
computed: { computed: {
loading() {
return this.$store.state.users.loading
},
passwordResetLink() {
return this.$store.state.users.passwordResetToken.link
},
passwordResetToken() {
return this.$store.state.users.passwordResetToken.token
},
statuses() { statuses() {
return this.$store.state.userProfile.statuses return this.$store.state.userProfile.statuses
}, },
...@@ -115,8 +141,15 @@ export default { ...@@ -115,8 +141,15 @@ export default {
this.$store.dispatch('FetchUserProfile', { userId: this.$route.params.id, godmode: false }) this.$store.dispatch('FetchUserProfile', { userId: this.$route.params.id, godmode: false })
}, },
methods: { methods: {
closeResetPasswordDialog() {
this.resetPasswordDialogOpen = false
this.$store.dispatch('RemovePasswordToken')
},
onTogglePrivate() { onTogglePrivate() {
this.$store.dispatch('FetchUserProfile', { userId: this.$route.params.id, godmode: this.showPrivate }) this.$store.dispatch('FetchUserProfile', { userId: this.$route.params.id, godmode: this.showPrivate })
},
openResetPasswordDialog() {
this.resetPasswordDialogOpen = true
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment