Commit | Line | Data |
---|---|---|
a3ac374b BA |
1 | <template lang="pug"> |
2 | main | |
3 | .row | |
4 | .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 | |
f0c68a04 BA |
5 | div(v-if="authOk") |
6 | p {{ st.tr["Authentication successful!"] }} | |
7 | p {{ st.tr["Back to Hall in 3 seconds..."] }} | |
a3ac374b BA |
8 | </template> |
9 | ||
10 | <script> | |
11 | import { store } from "@/store"; | |
12 | import { ajax } from "@/utils/ajax"; | |
a3ac374b | 13 | export default { |
6808d7a1 | 14 | name: "my-auth", |
a3ac374b BA |
15 | data: function() { |
16 | return { | |
f0c68a04 BA |
17 | st: store.state, |
18 | authOk: false | |
a3ac374b BA |
19 | }; |
20 | }, | |
21 | created: function() { | |
6808d7a1 BA |
22 | ajax( |
23 | "/authenticate", | |
24 | "GET", | |
25 | { token: this.$route.params["token"] }, | |
26 | res => { | |
f0c68a04 | 27 | this.authOk = true; |
910d631b BA |
28 | this.st.user.id = res.id; |
29 | this.st.user.name = res.name; | |
30 | this.st.user.email = res.email; | |
31 | this.st.user.notify = res.notify; | |
32 | localStorage["myname"] = res.name; | |
33 | localStorage["myid"] = res.id; | |
f0c68a04 BA |
34 | setTimeout(() => { |
35 | this.$router.replace("/"); | |
36 | }, 3000); | |
6808d7a1 | 37 | } |
a3ac374b | 38 | ); |
6808d7a1 | 39 | } |
a3ac374b BA |
40 | }; |
41 | </script> |