summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/StartPageSetup.vue
diff options
context:
space:
mode:
authorJannik Schönartz2019-02-26 01:18:03 +0100
committerJannik Schönartz2019-02-26 01:18:03 +0100
commit741cf724ae6cff9b023016b9a6f42a8a9f23647c (patch)
tree49e8f95b7d88e8dc069a5d41e540c3160d6bc018 /webapp/src/components/StartPageSetup.vue
parent[webapp] small ui fixes (diff)
downloadbas-741cf724ae6cff9b023016b9a6f42a8a9f23647c.tar.gz
bas-741cf724ae6cff9b023016b9a6f42a8a9f23647c.tar.xz
bas-741cf724ae6cff9b023016b9a6f42a8a9f23647c.zip
[webapp/setup] StartPageSetup now uses the new UserCreateForm component & small fixes
Diffstat (limited to 'webapp/src/components/StartPageSetup.vue')
-rw-r--r--webapp/src/components/StartPageSetup.vue85
1 files changed, 16 insertions, 69 deletions
diff --git a/webapp/src/components/StartPageSetup.vue b/webapp/src/components/StartPageSetup.vue
index 32dd1a3..8d41f81 100644
--- a/webapp/src/components/StartPageSetup.vue
+++ b/webapp/src/components/StartPageSetup.vue
@@ -34,87 +34,38 @@
<template>
<div class="setup-page">
<label style="color: red; font-size: large">{{ $t('createRoot') }}</label>
- <v-form class="setup-form" ref="form" v-model="valid" lazy-validation @submit.prevent="setup">
- <v-text-field
- validate-on-blur
- :label="$t('username')"
- v-model="username"
- :rules="usernameRules"
- autocomplete="off"
- ></v-text-field>
- <v-text-field
- validate-on-blur
- type="password"
- :label="$t('password')"
- v-model="password"
- :rules="passwordRules"
- autocomplete="off"
- ></v-text-field>
- <v-text-field
- validate-on-blur
- type="password"
- :label="$t('confirmPassword')"
- v-model="confirmPassword"
- :rules="confirmPasswordRules"
- autocomplete="off"
- ></v-text-field>
- <v-text-field
- :label="$t('name')"
- autocomplete="off"
- v-model="name"
- ></v-text-field>
- <v-text-field
- validate-on-blur
- :label="$t('email')"
- :rules="emailRules"
- autocomplete="off"
- v-model="email"
- ></v-text-field>
- <v-btn type="submit" class="setup-button primary" raised>{{ $t('signup') }}</v-btn>
- </v-form>
+ <signup v-model="user" ref="setupRoot"></signup>
+ <v-btn @click="setup" class="setup-button primary" raised>{{ $t('signup') }}</v-btn>
</div>
</template>
<script>
import Vue from 'vue'
+import signup from '@/components/UserCreateForm'
export default {
name: 'StartPageSetup',
+ components: {
+ signup
+ },
data () {
return {
- valid: true,
- username: '',
- usernameError: false,
- usernameRules: [
- v => !!v || this.$t('usernameEmptyError'),
- v => !this.usernameError || this.$t('usernameError')
- ],
- password: '',
- passwordError: false,
- passwordRules: [
- v => !!v || this.$t('passwordEmptyError'),
- v => v.length >= 8 || this.$t('passwordLengthError'),
- v => !this.passwordError || this.$t('passwordError')
- ],
- confirmPassword: '',
- confirmPasswordRules: [
- v => !!v || this.$t('passwordEmptyError'),
- v => v === this.password || this.$t('passwordMatchError')
- ],
- confirmPasswordError: false,
- email: '',
- emailRules: [
- v => this.$validateEmail(v) || this.$t('emailError')
- ],
- name: ''
+ user: { }
}
},
methods: {
setup () {
- if (this.$refs.form.validate()) {
- this.$http.post('/api/authentication/setup', { username: this.username, password: this.password, name: this.name, email: this.email }).then(response => {
+ if (this.$refs.setupRoot.validate()) {
+ this.$http.post('/api/authentication/setup', {
+ username: this.user.username,
+ password: this.user.password,
+ name: this.user.name,
+ email: this.user.email
+ }).then(response => {
this.$snackbar({ color: 'success', text: this.$t('rootCreated'), timeout: 15000 })
this.$router.replace({ name: 'login' })
+ }).catch(error => {
+ this.$snackbar({ color: 'error', text: error.response.data.error_message, timeout: 15000 })
})
}
}
@@ -139,10 +90,6 @@ export default {
align-items: center;
}
-.setup-form {
- width: 300px;
-}
-
.setup-button {
margin-top: 20px;
float: right;