create Force Reset Password Modal

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-19 13:24:28 +02:00
parent dc0fb8fbfe
commit 728bbe473a
2 changed files with 38 additions and 0 deletions

View File

@ -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 {

View File

@ -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>