Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Login.vue
Show All 37 Lines | <div class="container d-flex flex-column align-items-center justify-content-center"> | ||||
<svg-icon icon="sign-in-alt"></svg-icon> Sign in | <svg-icon icon="sign-in-alt"></svg-icon> Sign in | ||||
</button> | </button> | ||||
</div> | </div> | ||||
</form> | </form> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="mt-1"> | <div class="mt-1"> | ||||
<router-link v-if="!$root.isAdmin" :to="{ name: 'password-reset' }" id="forgot-password">Forgot password?</router-link> | <router-link v-if="!$root.isAdmin && $root.hasRoute('password-reset')" :to="{ name: 'password-reset' }" id="forgot-password">Forgot password?</router-link> | ||||
<a v-if="!$root.isAdmin && !$root.hasRoute('password-reset')" :href="app_url + '/password-reset'" id="forgot-password">Forgot password?</a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
export default { | export default { | ||||
props: { | |||||
dashboard: { type: Boolean, default: true } | |||||
}, | |||||
data() { | data() { | ||||
return { | return { | ||||
app_url: window.config['app.url'], | |||||
email: '', | email: '', | ||||
password: '', | password: '', | ||||
secondFactor: '' | secondFactor: '' | ||||
} | } | ||||
}, | }, | ||||
methods: { | methods: { | ||||
submitLogin() { | submitLogin() { | ||||
this.$root.clearFormValidation($('form.form-signin')) | this.$root.clearFormValidation($('form.form-signin')) | ||||
axios.post('/api/auth/login', { | axios.post('/api/auth/login', { | ||||
email: this.email, | email: this.email, | ||||
password: this.password, | password: this.password, | ||||
secondfactor: this.secondFactor | secondfactor: this.secondFactor | ||||
}).then(response => { | }).then(response => { | ||||
// login user and redirect to dashboard | // login user and redirect to dashboard | ||||
this.$root.loginUser(response.data) | this.$root.loginUser(response.data, this.dashboard) | ||||
this.$emit('success') | |||||
}) | }) | ||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |