annotate client/src/views/Login.vue @ 541:ee86ab038a7e

fix: Autogrow added for loginmask
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 30 Aug 2018 12:57:27 +0200
parents 924490b3395b
children 9d999d29c642
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 -->
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
12 <div id="alert" :style="errorMessageStyle" :class="errorMessageClass" role="alert">
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
13 <span>{{ errorMessage }}</span>
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
14 </div>
541
ee86ab038a7e fix: Autogrow added for loginmask
Thomas Junk <thomas.junk@intevation.de>
parents: 539
diff changeset
15 <form class="loginform" @submit.prevent="login">
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";
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 export default {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 name: "login",
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 data() {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 return {
158
992e17912405 feat: Improve login against real db
Thomas Junk <thomas.junk@intevation.de>
parents: 154
diff changeset
99 user: "",
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
100 password: "",
10
361ae8211991 refactored to component local state
Thomas Junk <thomas.junk@intevation.de>
parents: 9
diff changeset
101 submitted: false,
33
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
102 loginFailed: false,
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
103 passwordJustResetted: false,
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
104 readablePassword: false,
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
105 showPasswordReset: false,
505
61170d775158 Do not call the username email
Tom Gottfried <tom@intevation.de>
parents: 485
diff changeset
106 usernameToReset: ""
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 };
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 computed: {
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
110 errorMessage() {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
111 if (this.loginFailed) return this.$gettext("Login failed");
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
112 if (this.passwordJustResetted)
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
113 return this.$gettext("Password reset requested!");
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
114 return "&npsp;";
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
115 },
154
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
116 passwordLabel() {
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
117 return this.$gettext("Enter passphrase");
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
118 },
505
61170d775158 Do not call the username email
Tom Gottfried <tom@intevation.de>
parents: 485
diff changeset
119 usernameLabel() {
61170d775158 Do not call the username email
Tom Gottfried <tom@intevation.de>
parents: 485
diff changeset
120 return this.$gettext("Enter username");
154
2ba329e82fb0 Wrap vue templates with translation in parentheses
Thomas Junk <thomas.junk@intevation.de>
parents: 150
diff changeset
121 },
117
5e95c62a7e74 Move component. Re-add Css.
Thomas Junk <thomas.junk@intevation.de>
parents: 33
diff changeset
122 isPasswordVisible() {
33
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
123 return this.readablePassword ? "text" : "password";
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
124 },
122
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
125 eyeIcon() {
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
126 return {
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
127 fa: true,
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
128 "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
129 "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
130 };
da279a0ce127 The "eye" icon changes into a "crossed out eye" icon
Thomas Junk <thomas.junk@intevation.de>
parents: 117
diff changeset
131 },
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
132 errorMessageStyle() {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
133 if (this.loginFailed || this.passwordJustResetted) {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
134 return "visibility:visible";
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
135 }
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
136 return "visibility:hidden";
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
137 },
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
138 errorMessageClass() {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
139 let result = {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
140 "mb-3": true,
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
141 errormessage: true,
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
142 alert: true
32
0c19dcc352f9 Dynamic height of dialogbox
Thomas Junk <thomas.junk@intevation.de>
parents: 25
diff changeset
143 };
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
144 if (this.loginFailed) {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
145 result["alert-danger"] = true;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
146 }
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
147 if (this.passwordJustResetted) {
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
148 result["alert-info"] = true;
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
149 }
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
150 return result;
32
0c19dcc352f9 Dynamic height of dialogbox
Thomas Junk <thomas.junk@intevation.de>
parents: 25
diff changeset
151 },
141
Thomas Junk <thomas.junk@intevation.de>
parents: 122
diff changeset
152 ...mapGetters("application", ["appTitle", "secondaryLogo"])
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
153 },
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
154 methods: {
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
155 login() {
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
156 this.submitted = true;
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
157 this.passwordJustResetted = false;
158
992e17912405 feat: Improve login against real db
Thomas Junk <thomas.junk@intevation.de>
parents: 154
diff changeset
158 const { user, password } = this;
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
159 this.$store
158
992e17912405 feat: Improve login against real db
Thomas Junk <thomas.junk@intevation.de>
parents: 154
diff changeset
160 .dispatch("user/login", { user, password })
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
161 .then(() => {
10
361ae8211991 refactored to component local state
Thomas Junk <thomas.junk@intevation.de>
parents: 9
diff changeset
162 this.loginFailed = false;
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
163 this.$router.push("/");
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
164 })
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
165 .catch(() => {
10
361ae8211991 refactored to component local state
Thomas Junk <thomas.junk@intevation.de>
parents: 9
diff changeset
166 this.loginFailed = true;
6
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
167 this.submitted = false;
7c1bde663c8e current frontend
Thomas Junk <thomas.junk@intevation.de>
parents: 3
diff changeset
168 });
33
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
169 },
ae6535d44563 Make password readable. Moved Layout to separate file.
Thomas Junk <thomas.junk@intevation.de>
parents: 32
diff changeset
170 showPassword() {
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
171 // disable button when in reset mode
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
172 if (!this.showPasswordReset) {
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
173 this.readablePassword = !this.readablePassword;
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
174 }
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
175 },
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
176 togglePasswordReset() {
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
177 this.passwordJustResetted = false;
485
7a8644e9e50e client: add (unwired) password reset form
Bernhard Reiter <bernhard@intevation.de>
parents: 166
diff changeset
178 this.showPasswordReset = !this.showPasswordReset;
539
924490b3395b refac: Loginmask reworked
Thomas Junk <thomas.junk@intevation.de>
parents: 534
diff changeset
179 this.loginFailed = false;
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
180 },
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
181 resetPassword() {
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
182 if (this.user) {
534
f96d18e53369 Client: add passwordrest api call.
Bernhard Reiter <bernhard@intevation.de>
parents: 529
diff changeset
183 HTTP.post("/users/passwordreset", { user: this.user }).catch(error => {
f96d18e53369 Client: add passwordrest api call.
Bernhard Reiter <bernhard@intevation.de>
parents: 529
diff changeset
184 console.log("backend problem", error);
f96d18e53369 Client: add passwordrest api call.
Bernhard Reiter <bernhard@intevation.de>
parents: 529
diff changeset
185 });
529
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
186 this.togglePasswordReset();
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
187 this.passwordJustResetted = true;
b07763345352 client: add more password reset ui
Bernhard Reiter <bernhard@intevation.de>
parents: 505
diff changeset
188 }
3
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
189 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
190 }
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
191 };
1597506a2241 merge with vue-cli
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
192 </script>