Skip to content

Commit 82a8de3

Browse files
committed
WIP update login
1 parent 455ac13 commit 82a8de3

File tree

1 file changed

+79
-78
lines changed

1 file changed

+79
-78
lines changed

src/components/auth/Login.vue

Lines changed: 79 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
Login
3535
</v-btn>
3636
<v-btn
37-
@click="login"
37+
@click="register"
3838
>
3939
Sign Up
4040
</v-btn>
@@ -82,158 +82,159 @@
8282
</template>
8383
<script>
8484
export default {
85-
mounted () {
85+
mounted() {
8686
this.$auth.logout();
8787
this.$auth.state("/realtime-database", "/login").then(user => {
8888
if (!user) {
8989
this.ready = false;
9090
}
9191
});
9292
},
93-
data () {
93+
data() {
9494
return {
9595
snackbar: false,
9696
email: "",
9797
password: "",
9898
error: "",
9999
ready: false,
100100
emailRules: [
101-
v => !!v || 'E-mail is required',
102-
v => /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || 'E-mail must be valid'
101+
v => !!v || "E-mail is required",
102+
v =>
103+
/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
104+
"E-mail must be valid"
103105
],
104106
e3: true
105107
};
106108
},
107109
computed: {},
108110
methods: {
109-
login () {
110-
this.ready = true
111-
this.$auth.logout()
111+
login() {
112+
this.ready = true;
113+
this.$auth.logout();
112114
this.$auth
113115
.loginWithEmailAndPassword(this.email, this.password)
114116
.then(user => {
115-
this.ready = false
117+
this.ready = false;
116118
})
117119
.catch(error => {
118-
this.snackbar = true
119-
this.ready = false
120-
this.error = error.message
120+
this.snackbar = true;
121+
this.ready = false;
122+
this.error = error.message;
121123
});
122124
},
123-
register () {
125+
register() {
124126
this.ready = true;
125127
this.$auth
126128
.registerWithEmailAndPassword(this.email, this.password)
127129
.then(user => {
128-
this.ready = false
130+
this.ready = false;
129131
})
130132
.catch(error => {
131-
this.error = error.message
132-
this.ready = false
133-
this.snackbar = true
133+
this.error = error.message;
134+
this.ready = false;
135+
this.snackbar = true;
134136
});
135137
},
136-
signInGoogle () {
137-
this.ready = true
138+
signInGoogle() {
139+
this.ready = true;
138140
this.$auth
139141
.signInWithGoogle()
140142
.then(result => {
141143
// This gives you the Google's Access Token. You can use it to access the Google API.
142144
// console.log("Token : " + result.credential.accessToken)
143145
// The signed-in user info.
144146
// console.log("User Email : " + result.user.email)
145-
this.ready = false
147+
this.ready = false;
146148
})
147149
.catch(error => {
148-
this.error = error.message
149-
this.ready = false
150-
this.snackbar = true
151-
150+
this.error = error.message;
151+
this.ready = false;
152+
this.snackbar = true;
152153
});
153154
},
154-
signInFacebook () {
155-
this.ready = true
155+
signInFacebook() {
156+
this.ready = true;
156157
this.$auth
157158
.signInWithFacebook()
158159
.then(result => {
159-
this.ready = false
160+
this.ready = false;
160161
})
161162
.catch(error => {
162-
this.error = error.message
163-
this.ready = false
164-
this.snackbar = true
163+
this.error = error.message;
164+
this.ready = false;
165+
this.snackbar = true;
165166
});
166167
},
167-
signInTwitter () {
168-
this.ready = true
168+
signInTwitter() {
169+
this.ready = true;
169170
this.$auth
170171
.signInWithTwitter()
171172
.then(result => (this.ready = false))
172173
.catch(error => {
173-
this.error = error.message
174-
this.ready = false
175-
this.snackbar = true
174+
this.error = error.message;
175+
this.ready = false;
176+
this.snackbar = true;
176177
});
177178
},
178-
signInGithub () {
179-
this.ready = true
179+
signInGithub() {
180+
this.ready = true;
180181
this.$auth
181182
.signInWithGithub()
182183
.then(result => (this.ready = false))
183184
.catch(error => {
184-
this.error = error.message
185-
this.ready = false
186-
this.snackbar = true
185+
this.error = error.message;
186+
this.ready = false;
187+
this.snackbar = true;
187188
});
188189
},
189-
clear () {
190-
this.$refs.form.reset()
190+
clear() {
191+
this.$refs.form.reset();
191192
}
192193
}
193194
};
194195
</script>
195196

196197

197198
<style scoped>
198-
.push-down {
199-
margin-top: 15px;
200-
}
199+
.push-down {
200+
margin-top: 15px;
201+
}
201202
202-
.icon {
203-
height: 18px;
204-
width: 18px;
205-
margin-right: 8px;
206-
}
207-
.mdl-layout {
208-
align-items: center;
209-
justify-content: center;
210-
}
211-
.mdl-layout__content {
212-
padding: 24px;
213-
flex: none;
214-
}
203+
.icon {
204+
height: 18px;
205+
width: 18px;
206+
margin-right: 8px;
207+
}
208+
.mdl-layout {
209+
align-items: center;
210+
justify-content: center;
211+
}
212+
.mdl-layout__content {
213+
padding: 24px;
214+
flex: none;
215+
}
215216
216-
.facebook {
217-
background: #3b5998 !important;
218-
color: white;
219-
width: 100%;
220-
}
217+
.facebook {
218+
background: #3b5998 !important;
219+
color: white;
220+
width: 100%;
221+
}
221222
222-
.github {
223-
background: black !important;
224-
color: #fff;
225-
width: 100%;
226-
}
223+
.github {
224+
background: black !important;
225+
color: #fff;
226+
width: 100%;
227+
}
227228
228-
.twitter {
229-
background: #1da1f2 !important;
230-
color: #fff;
231-
width: 100%;
232-
}
229+
.twitter {
230+
background: #1da1f2 !important;
231+
color: #fff;
232+
width: 100%;
233+
}
233234
234-
.google {
235-
background: #727272 !important;
236-
color: #fff;
237-
width: 100%;
238-
}
235+
.google {
236+
background: #727272 !important;
237+
color: #fff;
238+
width: 100%;
239+
}
239240
</style>

0 commit comments

Comments
 (0)