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!"] }} | |
a3ac374b BA |
7 | </template> |
8 | ||
9 | <script> | |
10 | import { store } from "@/store"; | |
11 | import { ajax } from "@/utils/ajax"; | |
a3ac374b | 12 | export default { |
6808d7a1 | 13 | name: "my-auth", |
a3ac374b BA |
14 | data: function() { |
15 | return { | |
f0c68a04 BA |
16 | st: store.state, |
17 | authOk: false | |
a3ac374b BA |
18 | }; |
19 | }, | |
20 | created: function() { | |
6808d7a1 BA |
21 | ajax( |
22 | "/authenticate", | |
23 | "GET", | |
24 | { token: this.$route.params["token"] }, | |
25 | res => { | |
f0c68a04 | 26 | this.authOk = true; |
910d631b BA |
27 | this.st.user.id = res.id; |
28 | this.st.user.name = res.name; | |
29 | this.st.user.email = res.email; | |
30 | this.st.user.notify = res.notify; | |
31 | localStorage["myname"] = res.name; | |
32 | localStorage["myid"] = res.id; | |
6808d7a1 | 33 | } |
a3ac374b | 34 | ); |
6808d7a1 | 35 | } |
a3ac374b BA |
36 | }; |
37 | </script> |