| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2021-01-26 15:37:45 +00:00
										 |  |  |   <q-page padding class="fit row justify-center items-center content-center"> | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |     <q-card class="col-xs-11 col-sm-8 col-md-6 col-lg-4 justify-center items-center content-center"> | 
					
						
							|  |  |  |       <q-toolbar class="bg-primary text-white"> | 
					
						
							| 
									
										
										
										
											2021-01-26 15:37:45 +00:00
										 |  |  |         <q-toolbar-title> Passwort vergessen </q-toolbar-title> | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |       </q-toolbar> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <q-card-section> | 
					
						
							|  |  |  |         <q-form ref="ResetForm" @submit="doReset" class="q-gutter-md"> | 
					
						
							|  |  |  |           <q-input | 
					
						
							|  |  |  |             filled | 
					
						
							|  |  |  |             v-model="password" | 
					
						
							|  |  |  |             type="password" | 
					
						
							|  |  |  |             label="Passwort" | 
					
						
							|  |  |  |             :rules="rules" | 
					
						
							|  |  |  |             hint="Min. 8 Zeichen" | 
					
						
							|  |  |  |             tabindex="1" | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |           <q-input | 
					
						
							|  |  |  |             filled | 
					
						
							|  |  |  |             v-model="password2" | 
					
						
							|  |  |  |             type="password" | 
					
						
							|  |  |  |             label="Passwort Wiederholung" | 
					
						
							|  |  |  |             :rules="rules" | 
					
						
							|  |  |  |             tabindex="2" | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |           <div class="row justify-end"> | 
					
						
							|  |  |  |             <q-btn label="Zurücksetzen" type="submit" color="primary" /> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         </q-form> | 
					
						
							|  |  |  |       </q-card-section> | 
					
						
							|  |  |  |     </q-card> | 
					
						
							|  |  |  |   </q-page> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							|  |  |  | import { defineComponent, ref } from '@vue/composition-api'; | 
					
						
							|  |  |  | import { Loading, Notify } from 'quasar'; | 
					
						
							| 
									
										
										
										
											2021-01-21 15:23:40 +00:00
										 |  |  | import { AxiosResponse } from 'axios'; | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							|  |  |  |   // name: 'PageName'
 | 
					
						
							|  |  |  |   setup(_, { root }) { | 
					
						
							|  |  |  |     const password = ref(''); | 
					
						
							|  |  |  |     const password2 = ref(''); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const rules = [ | 
					
						
							|  |  |  |       (val: string) => | 
					
						
							| 
									
										
										
										
											2021-03-18 16:23:57 +00:00
										 |  |  |         (val && val.length >= 8) || 'Das Passwort muss mindestens 8 Zeichen lang sein!', | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function doReset() { | 
					
						
							|  |  |  |       if (password.value !== password2.value) { | 
					
						
							|  |  |  |         Notify.create({ | 
					
						
							|  |  |  |           group: false, | 
					
						
							|  |  |  |           type: 'negative', | 
					
						
							|  |  |  |           message: 'Die Passwörter stimmen nicht überein!', | 
					
						
							|  |  |  |           timeout: 10000, | 
					
						
							|  |  |  |           progress: true, | 
					
						
							| 
									
										
										
										
											2021-03-18 16:23:57 +00:00
										 |  |  |           actions: [{ icon: 'mdi-close', color: 'white' }], | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |         }); | 
					
						
							|  |  |  |         password2.value = ''; | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       Loading.show({ | 
					
						
							| 
									
										
										
										
											2021-03-18 16:23:57 +00:00
										 |  |  |         message: 'Das Passwort wird zurückgesetzt', | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |       }); | 
					
						
							|  |  |  |       root.$store | 
					
						
							|  |  |  |         .dispatch('session/resetPassword', { | 
					
						
							|  |  |  |           password: password.value, | 
					
						
							| 
									
										
										
										
											2021-03-18 16:23:57 +00:00
										 |  |  |           token: root.$route.query.token, | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |         }) | 
					
						
							| 
									
										
										
										
											2021-01-21 15:23:40 +00:00
										 |  |  |         .catch((error: AxiosResponse) => { | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |           if (error.status == 403) { | 
					
						
							|  |  |  |             Notify.create({ | 
					
						
							|  |  |  |               group: false, | 
					
						
							|  |  |  |               type: 'negative', | 
					
						
							|  |  |  |               message: 'Der Link ist abgelaufen!', | 
					
						
							|  |  |  |               timeout: 10000, | 
					
						
							|  |  |  |               progress: true, | 
					
						
							| 
									
										
										
										
											2021-03-18 16:23:57 +00:00
										 |  |  |               actions: [{ icon: 'mdi-close', color: 'white' }], | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  |             }); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         .finally(() => { | 
					
						
							|  |  |  |           Loading.hide(); | 
					
						
							|  |  |  |           void root.$router.replace({ name: 'login' }); | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return { password, password2, doReset, rules }; | 
					
						
							| 
									
										
										
										
											2021-03-18 16:23:57 +00:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-01-18 15:05:05 +00:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> |