annotate client/src/views/Login.vue @ 564:51a0c3e57ba6

fix: login errors now same width as other form components
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 04 Sep 2018 15:45:06 +0200
parents b91791664554
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
154
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
1 (<template>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
2 <div class="d-flex flex-column login shadow-lg">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
3 <div class="loginmask">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
4 <!-- logo section -->
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
5 <div class="d-flex flex-row justify-content-center mb-3">
25
a728610b3812 Add Light visual hints
Thomas Junk <thomas.junk@intevation.de>
parents: 24
diff changeset
6 <div class="logo"><img src="../assets/logo.png"></div>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
7 <div class="title">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
8 <h1>{{ appTitle }}</h1>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
9 </div>
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 </div>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
11 <!-- end logo section -->
541
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
12 <form class="loginform" @submit.prevent="login">
564
51a0c3e57ba6 fix: login errors now same width as other form components
Thomas Junk <thomas.junk@intevation.de>
parents: 546
diff changeset
13 <div id="alert" :style="errorMessageStyle" :class="errorMessageClass" role="alert">
51a0c3e57ba6 fix: login errors now same width as other form components
Thomas Junk <thomas.junk@intevation.de>
parents: 546
diff changeset
14 <span>{{ errorMessage }}</span>
51a0c3e57ba6 fix: login errors now same width as other form components
Thomas Junk <thomas.junk@intevation.de>
parents: 546
diff changeset
15 </div>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
16 <div class="input-group mb-3">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
17 <input type="text" v-model="user" id="inputUsername" class="form-control shadow-sm" :placeholder="usernameLabel" required autofocus>
11
e0b5dd98665e current frontend with asset server configured
Thomas Junk <thomas.junk@intevation.de>
parents: 10
diff changeset
18 </div>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
19 <div class="input-group mb-3">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
20 <input :type="isPasswordVisible" v-model="password" id="inputPassword" class="form-control shadow-sm" :placeholder='passwordLabel' :required='!showPasswordReset' :disabled='showPasswordReset'>
11
e0b5dd98665e current frontend with asset server configured
Thomas Junk <thomas.junk@intevation.de>
parents: 10
diff changeset
21 <div class="input-group-append">
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
22 <span class="input-group-text disabled" id="basic-addon2" @click="showPassword">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
23 <i :class="eyeIcon"></i>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
24 </span>
11
e0b5dd98665e current frontend with asset server configured
Thomas Junk <thomas.junk@intevation.de>
parents: 10
diff changeset
25 </div>
e0b5dd98665e current frontend with asset server configured
Thomas Junk <thomas.junk@intevation.de>
parents: 10
diff changeset
26 </div>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
27 <button v-if="showPasswordReset==false" class="btn btn-primary btn-block shadow-sm" :disabled="submitted || showPasswordReset" type="submit">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
28 <translate>Login</translate>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
29 </button>
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
30 <div v-if="showPasswordReset" class="passwordreset">
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
31 <button class="btn btn-block btn-info" type="button" @click="resetPassword">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
32 <translate>Request password reset!</translate>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
33 </button>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
34 <div class="pull-right">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
35 <a href="#" @click.prevent="togglePasswordReset">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
36 <translate>back to login</translate>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
37 </a>
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
38 </div>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
39 </div>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
40 <div v-else class="pull-right">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
41 <a href="#" @click.prevent="togglePasswordReset">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
42 <translate>Forgot password</translate>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
43 </a>
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
44 </div>
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
45 </form>
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
46
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
47 <!-- bottom logo section -->
541
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
48 <div class="mb-3 secondary-logo"><img :src="secondaryLogo"></div>
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
49 </div>
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 </div>
154
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
51 </template>)
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52
9
ee6d3836014e current version of login
Thomas Junk <thomas.junk@intevation.de>
parents: 6
diff changeset
53 <style lang="scss">
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
54 @import "../assets/application.scss";
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
55
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
56 .login {
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
57 background-color: white;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
58 min-width: 375px;
541
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
59 min-height: 500px;
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
60 @extend %fully-centered;
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
61 }
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
62
541
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
63 .loginform {
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
64 max-width: 375px;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
65 margin-left: auto;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
66 margin-right: auto;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
67 }
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
68
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
69 .loginmask {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
70 margin-left: $large-offset;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
71 margin-right: $large-offset;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
72 margin-top: $large-offset;
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
73 }
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
74
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
75 .logo {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
76 margin-right: $offset;
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
77 }
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
78
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
79 .alert {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
80 padding: 0.5rem;
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
81 }
541
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
82
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
83 .secondary-logo {
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
84 max-width: 375px;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
85 margin-left: auto;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
86 margin-right: auto;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
87 margin-bottom: auto;
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
88 }
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 </style>
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 <script>
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 import { mapGetters } from "vuex";
534
f96d18e53369 Client: add passwordrest api call.
Bernhard Reiter <bernhard@intevation.de>
parents: 529
diff changeset
93 import { HTTP } from "../lib/http";
545
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
94 import { displayError } from "../lib/errors.js";
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 export default {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 name: "login",
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 data() {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 return {
158
992e17912405 feat: Improve login against real db
Thomas Junk <thomas.junk@intevation.de>
parents: 154
diff changeset
100 user: "",
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
101 password: "",
10
361ae8211991 refactored to component local state
Thomas Junk <thomas.junk@intevation.de>
parents: 9
diff changeset
102 submitted: false,
33
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
103 loginFailed: false,
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
104 passwordJustResetted: false,
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
105 readablePassword: false,
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
106 showPasswordReset: false,
505
61170d775158 Do not call the username email
Tom Gottfried <tom@intevation.de>
parents: 485
diff changeset
107 usernameToReset: ""
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 };
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 },
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 computed: {
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
111 errorMessage() {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
112 if (this.loginFailed) return this.$gettext("Login failed");
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
113 if (this.passwordJustResetted)
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
114 return this.$gettext("Password reset requested!");
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
115 return "&npsp;";
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
116 },
154
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
117 passwordLabel() {
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
118 return this.$gettext("Enter passphrase");
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
119 },
505
61170d775158 Do not call the username email
Tom Gottfried <tom@intevation.de>
parents: 485
diff changeset
120 usernameLabel() {
61170d775158 Do not call the username email
Tom Gottfried <tom@intevation.de>
parents: 485
diff changeset
121 return this.$gettext("Enter username");
154
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
122 },
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
123 isPasswordVisible() {
33
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
124 return this.readablePassword ? "text" : "password";
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
125 },
122
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
126 eyeIcon() {
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
127 return {
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
128 fa: true,
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
129 "fa-eye": !this.readablePassword,
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
130 "fa-eye-slash": this.readablePassword
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
131 };
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
132 },
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
133 errorMessageStyle() {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
134 if (this.loginFailed || this.passwordJustResetted) {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
135 return "visibility:visible";
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
136 }
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
137 return "visibility:hidden";
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
138 },
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
139 errorMessageClass() {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
140 let result = {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
141 "mb-3": true,
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
142 errormessage: true,
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
143 alert: true
32
0c19dcc352f9 Dynamic height of dialogbox
Thomas Junk <thomas.junk@intevation.de>
parents: 25
diff changeset
144 };
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
145 if (this.loginFailed) {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
146 result["alert-danger"] = true;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
147 }
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
148 if (this.passwordJustResetted) {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
149 result["alert-info"] = true;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
150 }
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
151 return result;
32
0c19dcc352f9 Dynamic height of dialogbox
Thomas Junk <thomas.junk@intevation.de>
parents: 25
diff changeset
152 },
141
Thomas Junk <thomas.junk@intevation.de>
parents: 122
diff changeset
153 ...mapGetters("application", ["appTitle", "secondaryLogo"])
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
154 },
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
155 methods: {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
156 login() {
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
157 this.submitted = true;
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
158 this.passwordJustResetted = false;
158
992e17912405 feat: Improve login against real db
Thomas Junk <thomas.junk@intevation.de>
parents: 154
diff changeset
159 const { user, password } = this;
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
160 this.$store
158
992e17912405 feat: Improve login against real db
Thomas Junk <thomas.junk@intevation.de>
parents: 154
diff changeset
161 .dispatch("user/login", { user, password })
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
162 .then(() => {
10
361ae8211991 refactored to component local state
Thomas Junk <thomas.junk@intevation.de>
parents: 9
diff changeset
163 this.loginFailed = false;
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
164 this.$router.push("/");
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
165 })
546
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
166 .catch(error => {
10
361ae8211991 refactored to component local state
Thomas Junk <thomas.junk@intevation.de>
parents: 9
diff changeset
167 this.loginFailed = true;
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
168 this.submitted = false;
546
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
169 const { status, data } = error.response;
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
170 displayError({
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
171 title: "Backend Error",
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
172 message: `${status}: ${data.message || data}`
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
173 });
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
174 });
33
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
175 },
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
176 showPassword() {
545
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
177 // disallowing toggle when in reset mode
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
178 if (this.showPasswordReset) return;
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
179 this.readablePassword = !this.readablePassword;
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
180 },
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
181 togglePasswordReset() {
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
182 this.passwordJustResetted = false;
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
183 this.showPasswordReset = !this.showPasswordReset;
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
184 this.loginFailed = false;
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
185 },
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
186 resetPassword() {
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
187 if (this.user) {
534
f96d18e53369 Client: add passwordrest api call.
Bernhard Reiter <bernhard@intevation.de>
parents: 529
diff changeset
188 HTTP.post("/users/passwordreset", { user: this.user }).catch(error => {
545
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
189 const { status, data } = error.response;
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
190 displayError({
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
191 title: "Backend Error",
546
b91791664554 refac: Errorhandling and formatting
Thomas Junk <thomas.junk@intevation.de>
parents: 545
diff changeset
192 message: `${status}: ${data.message || data}`
545
9d999d29c642 fix: Console.log statement removed
Thomas Junk <thomas.junk@intevation.de>
parents: 541
diff changeset
193 });
534
f96d18e53369 Client: add passwordrest api call.
Bernhard Reiter <bernhard@intevation.de>
parents: 529
diff changeset
194 });
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
195 this.togglePasswordReset();
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
196 this.passwordJustResetted = true;
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
197 }
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
198 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
199 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
200 };
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
201 </script>