1
1
<template >
2
- <div >
3
- <v-container fluid fill-height >
4
- <v-layout align-center justify-center >
5
- <v-flex xs12 sm8 md4 >
6
- <v-card >
7
- <v-toolbar >
8
- <v-toolbar-title >Login</v-toolbar-title >
9
- </v-toolbar >
10
- <v-card-text >
11
- <v-form >
12
- <v-text-field
13
- v-model =" email"
14
- :counter =" 32"
15
- label =" email"
16
- prepend-icon =" mdi-email"
17
- />
18
- <v-text-field
19
- v-model =" password"
20
- :append-icon ="
21
- show_password ? 'mdi-visibility' : 'mdi-visibility_off'
22
- "
23
- :type =" show_password ? 'text' : 'password'"
24
- :counter =" 32"
25
- label =" password"
26
- prepend-icon =" mdi-lock"
27
- @click:append =" show_password = !show_password"
28
- />
29
- </v-form >
30
- </v-card-text >
31
- <v-card-actions >
32
- <v-btn @click =" gotoSignin" >Login</v-btn >
33
- <v-spacer />
34
- <v-btn @click =" doSignup" >Signup</v-btn >
35
- </v-card-actions >
36
- <hr />
37
- <v-spacer />
38
- <v-btn @click =" gotoResetPassword"
39
- >パスワードを忘れたかたはこちら</v-btn
40
- >
41
- </v-card >
42
- </v-flex >
43
- </v-layout >
44
- </v-container >
2
+ <div class =" SignUpPage" >
3
+ <v-flex >
4
+ <div class =" Logo" >
5
+ <Logo style =" height : 80vw ; max-height : 350px ; width : 100% ;" />
6
+ </div >
7
+ <div class =" SignUpForm" >
8
+ <v-form >
9
+ <v-text-field
10
+ v-model =" email"
11
+ :counter =" 32"
12
+ label =" email"
13
+ outlined
14
+ dark
15
+ prepend-icon =" mdi-email"
16
+ />
17
+ <v-text-field
18
+ v-model =" password"
19
+ :append-icon =" show_password ? 'mdi-eye' : 'mdi-eye-off'"
20
+ :type =" show_password ? 'text' : 'password'"
21
+ :counter =" 32"
22
+ label =" Password"
23
+ outlined
24
+ dark
25
+ prepend-icon =" mdi-lock"
26
+ @click:append =" show_password = !show_password"
27
+ />
28
+ <v-btn
29
+ block
30
+ outlined
31
+ color =" white"
32
+ height =" 40px"
33
+ :loading =" loading"
34
+ :disabled =" loading"
35
+ @click =" doSignup"
36
+ >
37
+ SIGNUP
38
+ </v-btn >
39
+ </v-form >
40
+ </div >
41
+ </v-flex >
45
42
</div >
46
43
</template >
47
44
48
45
<script >
49
46
import { mapActions } from ' vuex'
50
47
import firebase from ' @/plugins/firebase'
48
+ import Logo from ' @/assets/svgs/logo.svg'
49
+
51
50
export default {
51
+ components: {
52
+ Logo,
53
+ },
52
54
data () {
53
55
return {
54
56
email: ' ' ,
55
57
password: ' ' ,
56
58
show_password: false ,
59
+ loading: false ,
57
60
}
58
61
},
59
62
methods: {
60
63
... mapActions (' modules/user' , [' login' ]),
61
64
doSignup () {
65
+ this .loading = true
62
66
firebase
63
67
.auth ()
64
68
.createUserWithEmailAndPassword (this .email , this .password )
65
69
.then ((userInfo ) => {
66
- this .login ({
67
- uid: userInfo .user .uid ,
68
- email: userInfo .user .email ,
69
- username: userInfo .user .displayName ,
70
- userImage: userInfo .user .photoURL ,
71
- })
70
+ this .login (userInfo)
72
71
this .writeUserData (userInfo .user .uid , userInfo .user .email )
73
72
})
74
73
.then (() => {
75
74
this .$router .push (' /edit' )
76
75
})
77
76
.catch ((error ) => {
77
+ this .loading = false
78
78
alert (error)
79
79
})
80
80
},
@@ -85,10 +85,39 @@ export default {
85
85
this .$router .push (' /reset-password' )
86
86
},
87
87
writeUserData (userId , email ) {
88
+ const today = new Date ()
88
89
return firebase .firestore ().collection (' users' ).doc (userId).set ({
89
- email,
90
+ allow_access: [],
91
+ created_at: today,
92
+ updated_at: today,
93
+ last_login: today,
90
94
})
91
95
},
92
96
},
93
97
}
94
98
</script >
99
+
100
+ <style lang="scss" scoped>
101
+ .SignUpPage {
102
+ text-align : center ;
103
+ .Logo {
104
+ text-align : center ;
105
+ }
106
+ .SignUpTitle {
107
+ color : #ffffff ;
108
+ font-family : ' Noto Sans JP' ;
109
+ font-size : 5em ;
110
+ }
111
+ .DataBlock {
112
+ margin : 0 -12px ;
113
+ .studycard {
114
+ margin-bottom : 20px ;
115
+ }
116
+ }
117
+ .SignUpForm {
118
+ width : 90% ;
119
+ max-width : 600px ;
120
+ margin : 50px auto ;
121
+ }
122
+ }
123
+ </style >
0 commit comments