Move src to dashboard (#152)

This commit is contained in:
Pranav Raj S
2019-10-16 14:36:17 +05:30
committed by GitHub
parent 012a2743f2
commit 2783fb6006
187 changed files with 29 additions and 29 deletions

View File

@@ -0,0 +1,5 @@
<template>
<div class="row auth-wrap login align-center">
<router-view></router-view>
</div>
</template>

View File

@@ -0,0 +1,32 @@
<template>
<loading-state :message="$t('CONFIRM_EMAIL')"></loading-state>
</template>
<script>
/* eslint-disable */
import LoadingState from '../../components/widgets/LoadingState';
import Auth from '../../api/auth';
export default {
props: {
confirmationToken: String,
redirectUrl: String,
config: String,
},
components: {
LoadingState,
},
mounted() {
this.confirmToken();
},
methods: {
confirmToken() {
Auth.verifyPasswordToken({
confirmationToken: this.confirmationToken
}).then(res => {
window.location = res.data.redirect_url;
}).catch(res => {
window.location = res.data.redirect_url;
});
}
}
}
</script>

View File

@@ -0,0 +1,113 @@
<template>
<form class="login-box medium-4 column align-self-middle" v-on:submit.prevent="login()">
<div class="column log-in-form">
<h4>{{$t('SET_NEW_PASSWORD.TITLE')}}</h4>
<label :class="{ 'error': $v.credentials.password.$error }">
{{$t('LOGIN.PASSWORD.LABEL')}}
<input type="password" v-bind:placeholder="$t('SET_NEW_PASSWORD.PASSWORD.PLACEHOLDER')" v-model.trim="credentials.password" @input="$v.credentials.password.$touch">
<span class="message" v-if="$v.credentials.password.$error">
{{$t('SET_NEW_PASSWORD.PASSWORD.ERROR')}}
</span>
</label>
<label :class="{ 'error': $v.credentials.confirmPassword.$error }">
{{$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.LABEL')}}
<input type="password" v-bind:placeholder="$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.PLACEHOLDER')" v-model.trim="credentials.confirmPassword" @input="$v.credentials.confirmPassword.$touch">
<span class="message" v-if="$v.credentials.confirmPassword.$error">
{{$t('SET_NEW_PASSWORD.CONFIRM_PASSWORD.ERROR')}}
</span>
</label>
<woot-submit-button
:disabled="$v.credentials.password.$invalid || $v.credentials.confirmPassword.$invalid || newPasswordAPI.showLoading"
:button-text="$t('SET_NEW_PASSWORD.SUBMIT')"
:loading="newPasswordAPI.showLoading"
button-class="expanded"
>
</woot-submit-button>
<!-- <input type="submit" class="button " v-on:click.prevent="login()" v-bind:value="" > -->
</div>
</form>
</template>
<script>
/* global bus */
import { required, minLength } from 'vuelidate/lib/validators';
import Auth from '../../api/auth';
import WootSubmitButton from '../../components/buttons/FormSubmitButton';
export default {
components: {
WootSubmitButton,
},
props: {
resetPasswordToken: String,
redirectUrl: String,
config: String,
},
data() {
return {
// We need to initialize the component with any
// properties that will be used in it
credentials: {
confirmPassword: '',
password: '',
},
newPasswordAPI: {
message: '',
showLoading: false,
},
error: '',
};
},
mounted() {
// If url opened without token
// redirect to login
if (!this.resetPasswordToken) {
window.location = '/';
}
},
validations: {
credentials: {
password: {
required,
minLength: minLength(6),
},
confirmPassword: {
required,
minLength: minLength(6),
isEqPassword(value) {
if (value !== this.credentials.password) {
return false;
}
return true;
},
},
},
},
methods: {
showAlert(message) {
// Reset loading, current selected agent
this.newPasswordAPI.showLoading = false;
bus.$emit('newToastMessage', message);
},
login() {
this.newPasswordAPI.showLoading = true;
const credentials = {
confirmPassword: this.credentials.confirmPassword,
password: this.credentials.password,
resetPasswordToken: this.resetPasswordToken,
};
Auth.setNewPassword(credentials)
.then((res) => {
if (res.status === 200) {
window.location = res.data.redirect_url;
}
})
.catch(() => {
this.showAlert(this.$t('SET_NEW_PASSWORD.API.ERROR_MESSAGE'));
});
},
},
};
</script>

View File

@@ -0,0 +1,83 @@
<template>
<form
class="login-box medium-4 column align-self-middle"
@submit.prevent="submit()"
>
<h4>{{ $t('RESET_PASSWORD.TITLE') }}</h4>
<div class="column log-in-form">
<label :class="{ error: $v.credentials.email.$error }">
{{ $t('RESET_PASSWORD.EMAIL.LABEL') }}
<input
v-model.trim="credentials.email"
type="text"
:placeholder="$t('RESET_PASSWORD.EMAIL.PLACEHOLDER')"
@input="$v.credentials.email.$touch"
/>
<span v-if="$v.credentials.email.$error" class="message">
{{ $t('RESET_PASSWORD.EMAIL.ERROR') }}
</span>
</label>
<woot-submit-button
:disabled="$v.credentials.email.$invalid || resetPassword.showLoading"
:button-text="$t('RESET_PASSWORD.SUBMIT')"
:loading="resetPassword.showLoading"
button-class="expanded"
/>
</div>
</form>
</template>
<script>
/* global bus */
import { required, minLength, email } from 'vuelidate/lib/validators';
import Auth from '../../api/auth';
import { frontendURL } from '../../helper/URLHelper';
export default {
data() {
return {
// We need to initialize the component with any
// properties that will be used in it
credentials: {
email: '',
},
resetPassword: {
message: '',
showLoading: false,
},
error: '',
};
},
validations: {
credentials: {
email: {
required,
email,
minLength: minLength(4),
},
},
},
methods: {
showAlert(message) {
// Reset loading, current selected agent
this.resetPassword.showLoading = false;
bus.$emit('newToastMessage', message);
},
submit() {
this.resetPassword.showLoading = true;
Auth.resetPassword(this.credentials)
.then(res => {
let successMessage = this.$t('RESET_PASSWORD.API.SUCCESS_MESSAGE');
if (res.data && res.data.message) {
successMessage = res.data.message;
}
this.showAlert(successMessage);
window.location = frontendURL('login');
})
.catch(() => {
this.showAlert(this.$t('RESET_PASSWORD.API.ERROR_MESSAGE'));
});
},
},
};
</script>

View File

@@ -0,0 +1,137 @@
<template>
<div class="medium-10 column signup">
<div class="text-center medium-12 signup--hero">
<img
src="~dashboard/assets/images/woot-logo.svg"
alt="Woot-logo"
class="hero--logo"
/>
<h2 class="hero--title">
{{ $t('REGISTER.TRY_WOOT') }}
</h2>
<p class="hero--sub">
{{ $t('REGISTER.TRY_WOOT_SUB') }}
</p>
</div>
<div class="row align-center">
<div class="medium-5 column">
<ul class="signup--features">
<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">
<form class="signup--box login-box " @submit.prevent="submit()">
<div class="column log-in-form">
<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') }}
</span>
</label>
<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') }}
</span>
</label>
<woot-submit-button
:disabled="
$v.credentials.name.$invalid ||
$v.credentials.email.$invalid ||
register.showLoading
"
:button-text="$t('REGISTER.SUBMIT')"
:loading="register.showLoading"
button-class="large expanded"
>
</woot-submit-button>
<p class="accept--terms" v-html="$t('REGISTER.TERMS_ACCEPT')"></p>
</div>
</form>
<div class="column text-center sigin--footer">
<span>Already have an account?</span>
<router-link to="auth/login">
{{ $t('LOGIN.TITLE') }}
</router-link>
</div>
</div>
</div>
</div>
</template>
<script>
/* global bus */
import { required, minLength, email } from 'vuelidate/lib/validators';
import Auth from '../../api/auth';
import { frontendURL } from '../../helper/URLHelper';
export default {
data() {
return {
// We need to initialize the component with any
// properties that will be used in it
credentials: {
name: '',
email: '',
},
register: {
message: '',
showLoading: false,
},
error: '',
};
},
validations: {
credentials: {
name: {
required,
minLength: minLength(4),
},
email: {
required,
email,
},
},
},
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)
.then(res => {
if (res.status === 200) {
window.location = frontendURL('dashboard');
}
})
.catch(error => {
let errorMessage = this.$t('REGISTER.API.ERROR_MESSAGE');
if (error.response && error.response.data.message) {
errorMessage = error.response.data.message;
}
this.showAlert(errorMessage);
});
},
},
};
</script>

View File

@@ -0,0 +1,48 @@
import Auth from './Auth';
import Confirmation from './Confirmation';
import Signup from './Signup';
import PasswordEdit from './PasswordEdit';
import ResetPassword from './ResetPassword';
import { frontendURL } from '../../helper/URLHelper';
export default {
routes: [
{
path: frontendURL('auth'),
name: 'auth',
component: Auth,
children: [
{
path: 'confirmation',
name: 'auth_confirmation',
component: Confirmation,
props: route => ({
config: route.query.config,
confirmationToken: route.query.confirmation_token,
redirectUrl: route.query.route_url,
}),
},
{
path: 'password/edit',
name: 'auth_password_edit',
component: PasswordEdit,
props: route => ({
config: route.query.config,
resetPasswordToken: route.query.reset_password_token,
redirectUrl: route.query.route_url,
}),
},
{
path: 'signup',
name: 'auth_signup',
component: Signup,
},
{
path: 'reset/password',
name: 'auth_reset_password',
component: ResetPassword,
},
],
},
],
};