Mercurial > gemma
view client/src/views/Login.vue @ 32:0c19dcc352f9
Dynamic height of dialogbox
Depending on status (loginfailed) the height of
the loginmask is now dynamic.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 26 Jun 2018 13:43:14 +0200 |
parents | a728610b3812 |
children | ae6535d44563 |
line wrap: on
line source
<template> <div :class="loginStyle"> <div> <div class="logogroup d-flex flex-row justify-content-center"> <div class="logo"><img src="../assets/logo.png"></div> <div class="title"><h1>{{ appTitle }}</h1></div> </div> </div> <div class="login-wrapper d-flex flex-row justify-content-center"> <form class="loginform form-signin" @submit.prevent="login"> <div v-if="loginFailed" class="loginerrormessage alert alert-danger" role="alert"> <span class="loginerror">{{ loginAttemptFailed }}</span> </div> <div class="input-group mb-3 emailgroup"> <div class="input-group-prepend"> <span class="input-group-text"><i class="fa fa-envelope-open-o mail-icon"></i></span> </div> <input type="text" v-model="username" id="inputEmail" class="form-control" :placeholder="emailLabel" required autofocus> </div> <div class="input-group mb-3 passwordgroup"> <div class="input-group-prepend"> <span class="input-group-text"><span class="password-icon">*</span></span> </div> <input type="password" v-model="password" id="inputPassword" class="form-control" :placeholder="passwordLabel" required> <div class="input-group-append"> <span class="input-group-text" id="basic-addon2"><i class="fa fa-eye"></i></span> </div> </div> <button class="submitbutton btn btn-lg btn-primary btn-block" :disabled="submitted" type="submit">{{ loginButtonLabel }}</button> <div class="forgottenlink"><a href="#">{{ passPhraseForgotten }}</a></div> <div class="secondary-logo"><img :src="secondaryLogo"></div> </form> </div> </div> </template> <style lang="scss"> @import "../assets/application.scss"; $collapsedheight: 470px; $fullheight: 550px; .emailgroup { box-shadow: $basic-shadow-light !important; } .forgottenlink { text-align: right; margin-top: $small-offset; margin-bottom: $small-offset; } #inputPassword { border-right: none; } .input-group-text { background-color: white !important; } .login { width: 375px; @extend %fully-centered; padding-top: $offset; padding-bottom: $offset; box-shadow: $basic-shadow; } .logincollapsed { height: $collapsedheight; } .loginfull { height: $fullheight; } .loginerror { white-space: pre; } .loginerrormessage { box-shadow: $basic-shadow-light !important; } .loginform { width: 300px; } .logogroup { margin-top: $offset; margin-bottom: $offset; } .mail-icon { width: $iconwidth; } .passwordgroup { box-shadow: $basic-shadow-light !important; } .password-icon { position: relative; top: 10px; font-size: $iconsize; line-height: $iconLineHeight; width: $iconwidth; } .submitbutton { box-shadow: $basic-shadow-light !important; } .title { margin-left: $offset; } </style> <script> import { mapGetters } from "vuex"; export default { name: "login", data() { return { username: "", password: "", submitted: false, loginFailed: false }; }, computed: { loginStyle: function() { return { login: true, logincollapsed: !this.loginFailed, loginfull: this.loginFailed, "bg-white": true, rounded: true }; }, ...mapGetters("application", ["appTitle", "secondaryLogo"]), ...mapGetters("i18n", [ "signinHeader", "emailLabel", "passwordLabel", "loginButtonLabel", "loginAttemptFailed", "passPhraseForgotten" ]) }, methods: { login() { this.submitted = true; const { username, password } = this; this.$store .dispatch("user/login", { username, password }) .then(() => { this.loginFailed = false; this.$router.push("/"); }) .catch(() => { this.loginFailed = true; this.submitted = false; }); } } }; </script>