mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
setup wizard funcionality upgrade for v2
This commit is contained in:
@@ -119,41 +119,19 @@ export default {
|
||||
if (this.admin.avatar) formData.append('avatar', this.admin.avatar)
|
||||
|
||||
axios
|
||||
.post('/api/setup/admin-setup', formData, {
|
||||
.post('/admin-setup', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
|
||||
// Set login state
|
||||
this.$store.commit('SET_AUTHORIZED', true)
|
||||
|
||||
if (localStorage.getItem('license') === 'Extended') {
|
||||
this.$store.commit('SET_SAAS', true)
|
||||
}
|
||||
|
||||
// Go to files page
|
||||
this.$router.push({ name: 'Dashboard' })
|
||||
|
||||
// Remove license from localStorage
|
||||
localStorage.removeItem('purchase_code')
|
||||
localStorage.removeItem('license')
|
||||
// Go to sign page
|
||||
window.location = '/sign-in'
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.response.status == 401) {
|
||||
if (error.response.data.error === 'invalid_client') {
|
||||
events.$emit('alert:open', {
|
||||
emoji: '🤔',
|
||||
title: this.$t('popup_passport_error.title'),
|
||||
message: this.$t('popup_passport_error.message'),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (error.response.status == 500) {
|
||||
if (error.response.status === 500) {
|
||||
events.$emit('alert:open', {
|
||||
emoji: '🤔',
|
||||
title: this.$t('popup_signup_error.title'),
|
||||
@@ -161,7 +139,7 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
if (error.response.status == 422) {
|
||||
if (error.response.status === 422) {
|
||||
if (error.response.data.errors['email']) {
|
||||
this.$refs.adminAccount.setErrors({
|
||||
Email: error.response.data.errors['email'],
|
||||
@@ -175,13 +153,21 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
})
|
||||
}).finally(() => this.isLoading = false)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.$scrollTop()
|
||||
|
||||
if (this.$root.$data.config.isSetupWizardDebug) {
|
||||
this.admin = {
|
||||
name: 'Jane Doe',
|
||||
email: 'howdy@hi5ve.digital',
|
||||
avatar: undefined,
|
||||
password: 'vuefilemanager',
|
||||
password_confirmation: 'vuefilemanager',
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -106,12 +106,12 @@
|
||||
</AppInputSwitch>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-card text-left">
|
||||
<div v-if="isExtended" class="card shadow-card text-left">
|
||||
<FormLabel>Subscription</FormLabel>
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Contact Email" rules="required" v-slot="{ errors }">
|
||||
<AppInputText :title="$t('Subscription Type')" description="Choose your preferred subscription system in advance. After installation and any other user registration, you can't change this setting later.">
|
||||
<SelectInput v-model="app.subscriptionType" :options="$store.getters.subscriptionTypes" :placeholder="$t('Select your subscription type')" />
|
||||
<SelectInput v-model="app.subscriptionType" :default="app.subscriptionType" :options="$store.getters.subscriptionTypes" :placeholder="$t('Select your subscription type')" />
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
@@ -165,6 +165,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
isExtended: undefined,
|
||||
app: {
|
||||
color: '#00BC7E',
|
||||
subscriptionType: undefined,
|
||||
@@ -254,6 +255,20 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.$scrollTop()
|
||||
|
||||
this.isExtended = localStorage.getItem('license') === 'Extended'
|
||||
|
||||
if (this.$root.$data.config.isSetupWizardDebug) {
|
||||
this.app.subscriptionType = 'metered'
|
||||
this.app.title = 'VueFileManager'
|
||||
this.app.description = 'Your private cloud storage software build on Laravel & Vue.js.'
|
||||
this.app.contactMail = 'howdy@hi5ve.digital'
|
||||
this.app.googleAnalytics = 'UA-123456789'
|
||||
this.app.defaultStorage = '5'
|
||||
this.app.userRegistration = 1
|
||||
this.app.storageLimitation = 1
|
||||
this.app.userVerification = 0
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -139,6 +139,7 @@ export default {
|
||||
async databaseCredentialsSubmit() {
|
||||
if (this.$root.$data.config.isSetupWizardDemo) {
|
||||
this.$router.push({name: 'EnvironmentSetup'})
|
||||
return
|
||||
}
|
||||
|
||||
// Validate fields
|
||||
@@ -158,7 +159,7 @@ export default {
|
||||
this.isLoading = false
|
||||
|
||||
// Redirect to next step
|
||||
this.$router.push({ name: 'InstallationDisclaimer' })
|
||||
this.$router.push({ name: 'EnvironmentSetup' })
|
||||
})
|
||||
.catch((error) => {
|
||||
if ((error.response.status = 500)) {
|
||||
@@ -173,6 +174,17 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.$scrollTop()
|
||||
|
||||
if (this.$root.$data.config.isSetupWizardDebug) {
|
||||
this.databaseCredentials = {
|
||||
connection: 'mysql',
|
||||
host: '127.0.0.1',
|
||||
port: '3306',
|
||||
name: 'vuefilemanager-v2',
|
||||
username: 'root',
|
||||
password: 'secret',
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Storage Service" rules="required" v-slot="{ errors }">
|
||||
<AppInputText title="Storage Service" :error="errors[0]" :is-last="storage.driver === 'local'">
|
||||
<SelectInput v-model="storage.driver" :options="storageServiceList" default="local" placeholder="Select your storage service" :isError="errors[0]" />
|
||||
<SelectInput v-model="storage.driver" :options="storageServiceList" :default="storage.driver" placeholder="Select your storage service" :isError="errors[0]" />
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Region" rules="required" v-slot="{ errors }">
|
||||
<AppInputText title="Region" description="Select your region where is your bucket/space created." :error="errors[0]">
|
||||
<SelectInput v-model="storage.region" :options="regionList" :key="storage.driver" placeholder="Select your region" :isError="errors[0]" />
|
||||
<SelectInput v-model="storage.region" :options="regionList" :default="storage.region" placeholder="Select your region" :isError="errors[0]" />
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Mail Driver" rules="required" v-slot="{ errors }">
|
||||
<AppInputText title="Mail Driver" :error="errors[0]" :is-last="!mailDriver || mailDriver === 'log'">
|
||||
<SelectInput v-model="mailDriver" :options="mailDriverList" placeholder="Select your mail driver" :isError="errors[0]" />
|
||||
<SelectInput v-model="mailDriver" :default="mailDriver" :options="mailDriverList" placeholder="Select your mail driver" :isError="errors[0]" />
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Mail Encryption" rules="required" v-slot="{ errors }">
|
||||
<AppInputText title="Mail Encryption" :error="errors[0]" :is-last="true">
|
||||
<SelectInput v-model="smtp.encryption" :options="encryptionList" placeholder="Select your mail encryption" :isError="errors[0]" />
|
||||
<SelectInput v-model="smtp.encryption" :default="smtp.encryption" :options="encryptionList" placeholder="Select your mail encryption" :isError="errors[0]" />
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
@@ -147,8 +147,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-card text-left">
|
||||
<FormLabel>Environment Setup</FormLabel>
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Environment" rules="required" v-slot="{ errors }">
|
||||
<AppInputText title="Environment" :error="errors[0]" :is-last="true">
|
||||
<SelectInput v-model="environment" :options="environmentSetupList" default="production" placeholder="Select your environment setup" :isError="errors[0]" />
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
|
||||
<InfoBox v-if="isError" type="error" class="!mb-5">
|
||||
<p>Something went wrong, please try it again.</p>
|
||||
<p>Whooops, something went wrong, please try it again.</p>
|
||||
</InfoBox>
|
||||
|
||||
<AuthButton class="w-full justify-center" icon="chevron-right" text="Save and Set General Settings" :loading="isLoading" :disabled="isLoading" />
|
||||
@@ -217,6 +227,17 @@ export default {
|
||||
return {
|
||||
isError: false,
|
||||
isLoading: false,
|
||||
environment: 'production',
|
||||
environmentSetupList: [
|
||||
{
|
||||
label: 'Production',
|
||||
value: 'production',
|
||||
},
|
||||
{
|
||||
label: 'Dev',
|
||||
value: 'local',
|
||||
},
|
||||
],
|
||||
ossRegions: [
|
||||
{
|
||||
label: 'China (Hangzhou)',
|
||||
@@ -529,6 +550,7 @@ export default {
|
||||
// Send request to get verify account
|
||||
axios
|
||||
.post('/api/setup/environment-setup', {
|
||||
environment: this.environment,
|
||||
storage: this.storage,
|
||||
mailDriver: this.mailDriver,
|
||||
smtp: this.smtp,
|
||||
@@ -537,22 +559,41 @@ export default {
|
||||
postmark: this.postmark,
|
||||
})
|
||||
.then(() => {
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
|
||||
// Redirect to next step
|
||||
this.$router.push({name: 'AppSetup'})
|
||||
})
|
||||
.catch((error) => {
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
this.isError = true
|
||||
|
||||
if (error.response.status === 500) {
|
||||
this.isError = true
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
beforeMount() {
|
||||
if (this.$root.$data.config.isSetupWizardDebug) {
|
||||
this.mailDriver = 'smtp'
|
||||
|
||||
this.smtp = {
|
||||
host: 'test.mail.com',
|
||||
port: 445,
|
||||
username: 'howdy@hi5ve.digital',
|
||||
password: 'root',
|
||||
encryption: 'ssl',
|
||||
}
|
||||
|
||||
this.environment = 'local'
|
||||
|
||||
this.storage.driver = 'local'
|
||||
//this.storage.key = '51oLNVBaNKcxHG0lFucxBbJyhxmTwmF3WnzVLRqMZj0'
|
||||
//this.storage.secret = 'sC1YuKsbWv7MdWugb9ZsYBqv2QZJ+QOuHZHEddOsAao'
|
||||
//this.storage.endpoint = 'https://nyc3.digitaloceanspaces.com'
|
||||
//this.storage.bucket = 'cloud'
|
||||
//this.storage.region = 'nyc3'
|
||||
setTimeout(() => this.storage.region = 'nyc3', 100)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$scrollTop()
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<AuthContentWrapper ref="auth" class="h-screen bg-white">
|
||||
<AuthContentWrapper ref="auth" class="h-screen dark:bg-dark-background bg-white">
|
||||
<!--Licence Verify-->
|
||||
<AuthContent name="licence-verify" :visible="true">
|
||||
<Headline title="Setup Wizard" description="Please set your purchase code before continue to set up your application.">
|
||||
@@ -49,6 +49,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
isExtended: undefined,
|
||||
purchaseCode: '',
|
||||
}
|
||||
},
|
||||
@@ -71,10 +72,20 @@ export default {
|
||||
.post('/api/setup/purchase-code', {
|
||||
purchaseCode: this.purchaseCode,
|
||||
})
|
||||
.then(() => {
|
||||
.then((response) => {
|
||||
// End loading
|
||||
this.isLoading = false
|
||||
|
||||
console.log(response);
|
||||
|
||||
if (response.data === 'b6896a44017217c36f4a6fdc56699728') {
|
||||
this.isExtended = true
|
||||
localStorage.setItem('license', 'Extended')
|
||||
} else {
|
||||
this.isExtended = false
|
||||
localStorage.setItem('license', 'Regular')
|
||||
}
|
||||
|
||||
localStorage.setItem('purchase_code', this.purchaseCode)
|
||||
|
||||
// Redirect to next step
|
||||
|
||||
Reference in New Issue
Block a user