removing initial user creation
This commit is contained in:
parent
29f6582ec0
commit
4c8c5c17b2
|
@ -25,10 +25,6 @@
|
||||||
applicationName: string().required("Your application must have a name."),
|
applicationName: string().required("Your application must have a name."),
|
||||||
}
|
}
|
||||||
const userValidation = {
|
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."),
|
roleId: string().required("You need to select a role for your user."),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +149,6 @@
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
const user = {
|
const user = {
|
||||||
email: $createAppStore.values.email,
|
|
||||||
password: $createAppStore.values.password,
|
|
||||||
roleId: $createAppStore.values.roleId,
|
roleId: $createAppStore.values.roleId,
|
||||||
}
|
}
|
||||||
const userResp = await api.post(`/api/users/metadata`, user)
|
const userResp = await api.post(`/api/users/metadata`, user)
|
||||||
|
|
|
@ -1,26 +1,9 @@
|
||||||
<script>
|
<script>
|
||||||
import { Input, Select } from "@budibase/bbui"
|
import { Input, Select } from "@budibase/bbui"
|
||||||
export let validationErrors
|
|
||||||
|
|
||||||
let blurred = { email: false, password: false }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h2>Create your first User</h2>
|
<h2>What's your role for this app?</h2>
|
||||||
<div class="container">
|
<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">
|
<Select label="Role" secondary name="roleId">
|
||||||
<option value="ADMIN">Admin</option>
|
<option value="ADMIN">Admin</option>
|
||||||
<option value="POWER_USER">Power User</option>
|
<option value="POWER_USER">Power User</option>
|
||||||
|
|
|
@ -42,7 +42,8 @@ exports.fetchMetadata = async function(ctx) {
|
||||||
exports.createMetadata = async function(ctx) {
|
exports.createMetadata = async function(ctx) {
|
||||||
const appId = ctx.appId
|
const appId = ctx.appId
|
||||||
const db = new CouchDB(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) {
|
if (!email) {
|
||||||
ctx.throw(400, "Require email to manage user")
|
ctx.throw(400, "Require email to manage user")
|
||||||
|
|
Loading…
Reference in New Issue