File tree Expand file tree Collapse file tree 3 files changed +41
-16
lines changed Expand file tree Collapse file tree 3 files changed +41
-16
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" hello" >
3
3
<h1 >{{ msg }}</h1 >
4
- <form
5
- >
6
- <input type = " email " v-model = " email " placeholder = " Email Adresse " >
7
- <br >
8
- <input type = " password " v-model = " password " placeholder = " Passwort " >
9
- <br >
10
- <input type =" button" value =" LOG IN " @click =" login " >
11
- </form >
4
+ <form >
5
+ < input type = " email " v-model = " email " placeholder = " Email Adresse " / >
6
+ <br / >
7
+ <input type = " password " v-model = " password " placeholder = " Passwort " / >
8
+ <br / >
9
+ <input type = " button " value = " LOG IN " @click = " login " / >
10
+ <input type =" button" value =" RESET PASSWORD " @click =" resetPassword " / >
11
+ </form >
12
12
</div >
13
13
</template >
14
14
15
15
<script >
16
16
export default {
17
- name: ' LoginForm' ,
17
+ name: " LoginForm" ,
18
18
props: {
19
- msg: String
19
+ msg: String ,
20
20
},
21
21
22
22
data () {
23
23
return {
24
24
email: " " ,
25
- password: " "
26
- }
25
+ password: " " ,
26
+ };
27
27
},
28
28
29
29
methods: {
30
30
login () {
31
31
this .$emit (" login" , {
32
32
email: this .email ,
33
- password: this .password
34
- })
33
+ password: this .password ,
34
+ });
35
+ },
36
+ resetPassword () {
37
+ this .$emit (" resetPassword" , this .email );
35
38
},
36
39
},
37
- }
40
+ };
38
41
</script >
39
42
40
43
<!-- Add "scoped" attribute to limit CSS to this component only -->
Original file line number Diff line number Diff line change @@ -39,6 +39,17 @@ export default new Vuex.Store({
39
39
fb . auth . signOut ( ) ;
40
40
commit ( "setUser" , { } ) ;
41
41
} ,
42
+ async resetPassword ( { commit } , email ) {
43
+ return fb . auth
44
+ . sendPasswordResetEmail ( email )
45
+ . then ( ( res ) => {
46
+ commit ( "setUser" , { } ) ;
47
+ return res ;
48
+ } )
49
+ . catch ( ( err ) => {
50
+ return err ;
51
+ } ) ;
52
+ } ,
42
53
async uploadProfilePicture ( { commit } , payload ) {
43
54
var storageRef = fb . storage . ref ( ) ;
44
55
var pictureRef = storageRef . child (
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div id =" app" >
3
3
<img alt =" Vue logo" src =" @/assets/logo.png" />
4
- <LoginForm @login =" login" v-if =" !user.uid" msg =" Bitte einloggen" />
4
+ <LoginForm
5
+ @login =" login"
6
+ @resetPassword =" resetPassword"
7
+ v-if =" !user.uid"
8
+ msg =" Bitte einloggen"
9
+ />
5
10
</div >
6
11
</template >
7
12
@@ -28,6 +33,12 @@ export default {
28
33
this .$router .push (" /dashboard" );
29
34
});
30
35
},
36
+ resetPassword (email ) {
37
+ console .log (" Email reset: " + email);
38
+ this .$store .dispatch (" resetPassword" , email).then (() => {
39
+ alert (" Password Reset sent out to: " + email);
40
+ });
41
+ },
31
42
},
32
43
};
33
44
</script >
You can’t perform that action at this time.
0 commit comments