2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
|
|
|
<div class="medium-10 column signup">
|
2019-10-05 08:34:24 +00:00
|
|
|
<div class="text-center medium-12 signup--hero">
|
2019-08-25 14:29:28 +00:00
|
|
|
<img
|
2020-05-11 20:01:40 +00:00
|
|
|
:src="globalConfig.logo"
|
|
|
|
:alt="globalConfig.installationName"
|
2019-10-05 08:34:24 +00:00
|
|
|
class="hero--logo"
|
2019-08-25 14:29:28 +00:00
|
|
|
/>
|
2019-10-05 08:34:24 +00:00
|
|
|
<h2 class="hero--title">
|
2019-08-25 14:29:28 +00:00
|
|
|
{{ $t('REGISTER.TRY_WOOT') }}
|
|
|
|
</h2>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
<div class="row align-center">
|
|
|
|
<div class="medium-5 column">
|
2019-10-05 08:34:24 +00:00
|
|
|
<ul class="signup--features">
|
2019-08-14 09:48:44 +00:00
|
|
|
<li><i class="ion-beer beer"></i>Unlimited Facebook Pages</li>
|
|
|
|
<li><i class="ion-stats-bars report"></i>Robust Reporting</li>
|
|
|
|
<li><i class="ion-chatbox-working canned"></i>Canned Responses</li>
|
|
|
|
<li><i class="ion-loop uptime"></i>Auto Assignment</li>
|
|
|
|
<li><i class="ion-locked secure"></i>Enterprise level security</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="medium-5 column">
|
2019-10-05 08:34:24 +00:00
|
|
|
<form class="signup--box login-box " @submit.prevent="submit()">
|
2019-08-14 09:48:44 +00:00
|
|
|
<div class="column log-in-form">
|
2019-08-25 14:29:28 +00:00
|
|
|
<label :class="{ error: $v.credentials.name.$error }">
|
|
|
|
{{ $t('REGISTER.ACCOUNT_NAME.LABEL') }}
|
|
|
|
<input
|
|
|
|
v-model.trim="credentials.name"
|
|
|
|
type="text"
|
|
|
|
:placeholder="$t('REGISTER.ACCOUNT_NAME.PLACEHOLDER')"
|
|
|
|
@input="$v.credentials.name.$touch"
|
|
|
|
/>
|
|
|
|
<span v-if="$v.credentials.name.$error" class="message">
|
|
|
|
{{ $t('REGISTER.ACCOUNT_NAME.ERROR') }}
|
2019-08-14 09:48:44 +00:00
|
|
|
</span>
|
|
|
|
</label>
|
2019-08-25 14:29:28 +00:00
|
|
|
<label :class="{ error: $v.credentials.email.$error }">
|
|
|
|
{{ $t('REGISTER.EMAIL.LABEL') }}
|
|
|
|
<input
|
|
|
|
v-model.trim="credentials.email"
|
|
|
|
type="email"
|
|
|
|
:placeholder="$t('REGISTER.EMAIL.PLACEHOLDER')"
|
|
|
|
@input="$v.credentials.email.$touch"
|
|
|
|
/>
|
|
|
|
<span v-if="$v.credentials.email.$error" class="message">
|
|
|
|
{{ $t('REGISTER.EMAIL.ERROR') }}
|
2019-08-14 09:48:44 +00:00
|
|
|
</span>
|
|
|
|
</label>
|
|
|
|
<woot-submit-button
|
2019-08-25 14:29:28 +00:00
|
|
|
:disabled="
|
|
|
|
$v.credentials.name.$invalid ||
|
|
|
|
$v.credentials.email.$invalid ||
|
|
|
|
register.showLoading
|
|
|
|
"
|
2019-08-14 09:48:44 +00:00
|
|
|
:button-text="$t('REGISTER.SUBMIT')"
|
|
|
|
:loading="register.showLoading"
|
|
|
|
button-class="large expanded"
|
|
|
|
>
|
|
|
|
</woot-submit-button>
|
2020-05-11 20:01:40 +00:00
|
|
|
<p class="accept--terms" v-html="termsLink"></p>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
2019-10-05 08:34:24 +00:00
|
|
|
<div class="column text-center sigin--footer">
|
2019-08-14 09:48:44 +00:00
|
|
|
<span>Already have an account?</span>
|
2020-03-09 17:57:10 +00:00
|
|
|
<router-link to="/app/login">
|
2020-05-11 20:01:40 +00:00
|
|
|
{{
|
|
|
|
useInstallationName(
|
|
|
|
$t('LOGIN.TITLE'),
|
|
|
|
globalConfig.installationName
|
|
|
|
)
|
|
|
|
}}
|
2019-08-14 09:48:44 +00:00
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
/* global bus */
|
|
|
|
|
|
|
|
import { required, minLength, email } from 'vuelidate/lib/validators';
|
|
|
|
import Auth from '../../api/auth';
|
2020-05-11 20:01:40 +00:00
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
export default {
|
2020-05-11 20:01:40 +00:00
|
|
|
mixins: [globalConfigMixin],
|
2019-08-14 09:48:44 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
credentials: {
|
|
|
|
name: '',
|
|
|
|
email: '',
|
|
|
|
},
|
|
|
|
register: {
|
|
|
|
message: '',
|
|
|
|
showLoading: false,
|
|
|
|
},
|
|
|
|
error: '',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
validations: {
|
|
|
|
credentials: {
|
|
|
|
name: {
|
|
|
|
required,
|
|
|
|
minLength: minLength(4),
|
|
|
|
},
|
|
|
|
email: {
|
|
|
|
required,
|
|
|
|
email,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-05-11 20:01:40 +00:00
|
|
|
computed: {
|
|
|
|
...mapGetters({
|
|
|
|
globalConfig: 'globalConfig/get',
|
|
|
|
}),
|
|
|
|
termsLink() {
|
|
|
|
return this.$t('REGISTER.TERMS_ACCEPT')
|
|
|
|
.replace('https://www.chatwoot.com/terms', this.globalConfig.termsURL)
|
|
|
|
.replace(
|
|
|
|
'https://www.chatwoot.com/privacy-policy',
|
|
|
|
this.globalConfig.privacyURL
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
methods: {
|
|
|
|
showAlert(message) {
|
|
|
|
// Reset loading, current selected agent
|
|
|
|
this.register.showLoading = false;
|
|
|
|
bus.$emit('newToastMessage', message);
|
|
|
|
},
|
|
|
|
submit() {
|
|
|
|
this.register.showLoading = true;
|
|
|
|
Auth.register(this.credentials)
|
2019-08-25 14:29:28 +00:00
|
|
|
.then(res => {
|
2019-08-14 09:48:44 +00:00
|
|
|
if (res.status === 200) {
|
2020-03-09 17:57:10 +00:00
|
|
|
window.location = '/';
|
2019-08-14 09:48:44 +00:00
|
|
|
}
|
|
|
|
})
|
2019-08-25 14:29:28 +00:00
|
|
|
.catch(error => {
|
2019-08-14 09:48:44 +00:00
|
|
|
let errorMessage = this.$t('REGISTER.API.ERROR_MESSAGE');
|
|
|
|
if (error.response && error.response.data.message) {
|
|
|
|
errorMessage = error.response.data.message;
|
|
|
|
}
|
|
|
|
this.showAlert(errorMessage);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|