removing initial user creation

This commit is contained in:
Martin McKeaveney 2021-04-14 17:02:12 +01:00
parent 6852d3c461
commit 0f6bfb53fc
3 changed files with 3 additions and 25 deletions

View File

@ -25,10 +25,6 @@
applicationName: string().required("Your application must have a name."),
}
const userValidation = {
email: string()
.email()
.required("Your application needs a first user."),
password: string().required("Please enter a password for your first user."),
roleId: string().required("You need to select a role for your user."),
}
@ -153,8 +149,6 @@
// Create user
const user = {
email: $createAppStore.values.email,
password: $createAppStore.values.password,
roleId: $createAppStore.values.roleId,
}
const userResp = await api.post(`/api/users/metadata`, user)

View File

@ -1,26 +1,9 @@
<script>
import { Input, Select } from "@budibase/bbui"
export let validationErrors
let blurred = { email: false, password: false }
</script>
<h2>Create your first User</h2>
<h2>What's your role for this app?</h2>
<div class="container">
<Input
on:input={() => (blurred.email = true)}
label="Email"
name="email"
placeholder="Email"
type="email"
error={blurred.email && validationErrors.email} />
<Input
on:input={() => (blurred.password = true)}
label="Password"
name="password"
placeholder="Password"
type="password"
error={blurred.password && validationErrors.password} />
<Select label="Role" secondary name="roleId">
<option value="ADMIN">Admin</option>
<option value="POWER_USER">Power User</option>

View File

@ -42,7 +42,8 @@ exports.fetchMetadata = async function(ctx) {
exports.createMetadata = async function(ctx) {
const appId = ctx.appId
const db = new CouchDB(appId)
const { email, roleId } = ctx.request.body
const { roleId } = ctx.request.body
const email = ctx.request.body.email || ctx.user.email
if (!email) {
ctx.throw(400, "Require email to manage user")