Mercurial > gemma
comparison client/src/usermanagement/Userdetail.vue @ 851:c0bb673d360e
mailbtn
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 28 Sep 2018 13:07:38 +0200 |
parents | 8278b2fb0c33 |
children | ca628dce90dd |
comparison
equal
deleted
inserted
replaced
850:fcb38cedc680 | 851:c0bb673d360e |
---|---|
58 </div> | 58 </div> |
59 </div> | 59 </div> |
60 <div> | 60 <div> |
61 <button type="submit" :disabled="submitted" class="shadow-sm btn btn-info pull-right">Submit</button> | 61 <button type="submit" :disabled="submitted" class="shadow-sm btn btn-info pull-right">Submit</button> |
62 </div> | 62 </div> |
63 <div v-if="currentUser.role !='waterway_user' " class="form-group row d-flex flex-row justify-content-start mailbutton"> | |
64 <a @click="sendTestMail" class="btn btn-light"><i class="fa fa-telegram"> Send testmail</i></a> | |
65 <div v-if="mailsent">Mail was sent</div> | |
66 </div> | |
63 </form> | 67 </form> |
64 </div> | 68 </div> |
65 </div> | 69 </div> |
66 </div> | 70 </div> |
67 </template> | 71 </template> |
68 | 72 |
69 <style lang="scss"> | 73 <style lang="scss"> |
74 .mailbutton { | |
75 width: 12vw; | |
76 } | |
70 .formfields { | 77 .formfields { |
71 width: 10vw; | 78 width: 10vw; |
72 } | 79 } |
73 | 80 |
74 .userdetails { | 81 .userdetails { |
82 margin-left: $offset; | 89 margin-left: $offset; |
83 font-size: $smaller; | 90 font-size: $smaller; |
84 } | 91 } |
85 </style> | 92 </style> |
86 <script> | 93 <script> |
94 import { HTTP } from "../application/lib/http"; | |
87 import { displayError } from "../application/lib/errors.js"; | 95 import { displayError } from "../application/lib/errors.js"; |
88 import { mapGetters } from "vuex"; | 96 import { mapGetters } from "vuex"; |
89 import PasswordField from "./Passwordfield"; | 97 import PasswordField from "./Passwordfield"; |
90 | 98 |
91 const emptyErrormessages = () => { | 99 const emptyErrormessages = () => { |
125 components: { | 133 components: { |
126 PasswordField | 134 PasswordField |
127 }, | 135 }, |
128 data() { | 136 data() { |
129 return { | 137 return { |
138 mailsent: false, | |
130 passwordLabel: "Password", | 139 passwordLabel: "Password", |
131 passwordReLabel: "Repeat Password", | 140 passwordReLabel: "Repeat Password", |
132 passwordPlaceholder: "password", | 141 passwordPlaceholder: "password", |
133 passwordRePlaceholder: "password again", | 142 passwordRePlaceholder: "password again", |
134 password: "", | 143 password: "", |
178 (this.password === "" || !violatedPasswordRules(this.password)) | 187 (this.password === "" || !violatedPasswordRules(this.password)) |
179 ); | 188 ); |
180 } | 189 } |
181 }, | 190 }, |
182 methods: { | 191 methods: { |
192 sendTestMail() { | |
193 if (this.mailsent) return; | |
194 HTTP.get("/testmail/" + this.currentUser.user, { | |
195 headers: { | |
196 "X-Gemma-Auth": localStorage.getItem("token"), | |
197 "Content-type": "text/xml; charset=UTF-8" | |
198 } | |
199 }) | |
200 .then(() => { | |
201 this.mailsent = true; | |
202 }) | |
203 .catch(error => { | |
204 this.loginFailed = true; | |
205 this.submitted = false; | |
206 const { status, data } = error.response; | |
207 displayError({ | |
208 title: "Backend Error", | |
209 message: `${status}: ${data.message || data}` | |
210 }); | |
211 }); | |
212 }, | |
183 passwordChanged(value) { | 213 passwordChanged(value) { |
184 this.password = value; | 214 this.password = value; |
185 this.validatePassword(); | 215 this.validatePassword(); |
186 }, | 216 }, |
187 passwordReChanged(value) { | 217 passwordReChanged(value) { |