wire up force reset password action
This commit is contained in:
parent
728bbe473a
commit
5d60a0b1f6
|
@ -108,8 +108,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="regenerate">
|
<div class="regenerate">
|
||||||
<ActionButton size="S" icon="Refresh" quiet
|
<ActionButton
|
||||||
>Regenerate password</ActionButton
|
size="S"
|
||||||
|
icon="Refresh"
|
||||||
|
quiet
|
||||||
|
on:click={resetPasswordModal.show}>Force password reset</ActionButton
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -161,7 +164,10 @@
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal bind:this={resetPasswordModal}>
|
<Modal bind:this={resetPasswordModal}>
|
||||||
<ForceResetPasswordModal user={$userFetch.data} />
|
<ForceResetPasswordModal
|
||||||
|
user={$userFetch.data}
|
||||||
|
on:update={userFetch.refresh}
|
||||||
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
import { ModalContent, Body, Input, notifications } from "@budibase/bbui"
|
import { ModalContent, Body, Input, notifications } from "@budibase/bbui"
|
||||||
import { users } from "stores/portal"
|
import { users } from "stores/portal"
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let user
|
export let user
|
||||||
|
|
||||||
const password = Math.random().toString(36).substr(2, 20)
|
const password = Math.random().toString(36).substr(2, 20)
|
||||||
|
|
||||||
async function resetPassword() {
|
async function resetPassword() {
|
||||||
const res = await users.save.create({ ...user, password })
|
const res = await users.save({ ...user, password })
|
||||||
if (res.status) {
|
if (res.status) {
|
||||||
notifications.error(res.message)
|
notifications.error(res.message)
|
||||||
} else {
|
} else {
|
||||||
notifications.success("Password reset.")
|
notifications.success("Password reset.")
|
||||||
|
dispatch("update")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import { Body, Select, ModalContent, notifications } from "@budibase/bbui"
|
import { Body, Select, ModalContent, notifications } from "@budibase/bbui"
|
||||||
import { fetchData } from "helpers"
|
|
||||||
import { users } from "stores/portal"
|
import { users } from "stores/portal"
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
|
|
Loading…
Reference in New Issue