create Force Reset Password Modal
This commit is contained in:
parent
06af8e70e6
commit
d74f47e227
|
@ -21,10 +21,12 @@
|
|||
|
||||
import TagsRenderer from "./_components/TagsTableRenderer.svelte"
|
||||
import UpdateRolesModal from "./_components/UpdateRolesModal.svelte"
|
||||
import ForceResetPasswordModal from "./_components/ForceResetPasswordModal.svelte"
|
||||
|
||||
export let userId
|
||||
let deleteUserModal
|
||||
let editRolesModal
|
||||
let resetPasswordModal
|
||||
|
||||
const roleSchema = {
|
||||
name: { displayName: "App" },
|
||||
|
@ -158,6 +160,9 @@
|
|||
on:update={userFetch.refresh}
|
||||
/>
|
||||
</Modal>
|
||||
<Modal bind:this={resetPasswordModal}>
|
||||
<ForceResetPasswordModal user={$userFetch.data} />
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.fields {
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<script>
|
||||
import { ModalContent, Body, Input, notifications } from "@budibase/bbui"
|
||||
import { users } from "stores/portal"
|
||||
|
||||
export let user
|
||||
|
||||
const password = Math.random().toString(36).substr(2, 20)
|
||||
|
||||
async function resetPassword() {
|
||||
const res = await users.save.create({ ...user, password })
|
||||
if (res.status) {
|
||||
notifications.error(res.message)
|
||||
} else {
|
||||
notifications.success("Password reset.")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<ModalContent
|
||||
onConfirm={resetPassword}
|
||||
size="M"
|
||||
title="Force Reset User Password"
|
||||
confirmText="Reset password"
|
||||
cancelText="Cancel"
|
||||
showCloseIcon={false}
|
||||
>
|
||||
<Body noPadding
|
||||
>Before you reset the users password, do not forget to copy the new
|
||||
password. The user will need this to login. Once the user has logged in they
|
||||
will be asked to create a new password that is more secure.</Body
|
||||
>
|
||||
<Input disabled label="Password" value={password} />
|
||||
</ModalContent>
|
Loading…
Reference in New Issue