Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit a5d5c23

Browse files
committed
Fixing oauth redirect issues available in sentry
1 parent b2c5865 commit a5d5c23

File tree

8 files changed

+41
-32
lines changed

8 files changed

+41
-32
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ VUE_APP_API_GOOGLE_REDIRECT_URI=
1717
VUE_APP_API_DISCORD_CLIENT_ID=
1818
VUE_APP_API_DISCORD_REDIRECT_URI=
1919

20+
# Spotify oauth configs
21+
VUE_APP_API_SPOTIFY_CLIENT_ID=
22+
VUE_APP_API_SPOTIFY_REDIRECT_URI=
23+
2024
# Recaptcha config
2125
VUE_APP_API_RECAPTCHA_SITE_KEY=

src/components/auth/Login.vue

+13-13
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@
100100
},
101101
login() {
102102
103-
// if (!this.recaptcha.valid) {
104-
// this.$notify({
105-
// group: 'auth',
106-
// type: 'error',
107-
// text: "Captcha is invalid!",
108-
// title: "Failed",
109-
// duration: 2000,
110-
// });
111-
// return
112-
// }
103+
if (!this.recaptcha.valid) {
104+
this.$notify({
105+
group: 'auth',
106+
type: 'error',
107+
text: "Captcha is invalid!",
108+
title: "Failed",
109+
duration: 2000,
110+
});
111+
return
112+
}
113113
114114
this.loading = true;
115115
@@ -181,9 +181,9 @@
181181
},
182182
},
183183
mounted() {
184-
let err = this.$route.params.err;
185-
if (err != null){
186-
this.$notify(err);
184+
let notify = this.$route.params.notify;
185+
if (notify != null){
186+
this.$notify(notify);
187187
}
188188
}
189189
}

src/components/auth/Register.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@
160160
password_confirmation: '',
161161
}
162162
},
163-
mounted() {
164-
let err = this.$route.params.err;
165-
if (err != null){
166-
this.$notify(err);
167-
}
168-
},
169163
methods: {
170164
171165
onCaptchaVerified(response) {
@@ -264,6 +258,12 @@
264258
DiscordOAUTHPage() {
265259
this.$router.push({ name: "discord_oauth_connect" });
266260
}
261+
},
262+
mounted() {
263+
let notify = this.$route.params.notify;
264+
if (notify != null){
265+
this.$notify(notify);
266+
}
267267
}
268268
}
269269
</script>

src/components/auth/oauth/discord/Callback.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
6565
this.$store.dispatch("OAUTHCallback", {
6666
service: "discord",
67-
code: this.$route.query.code
67+
code: this.$route.query.code,
68+
ref,
6869
}).then(() => {
6970
7071
this.loading = false;
@@ -105,7 +106,7 @@
105106
this.$router.push({
106107
name: "settings",
107108
params: {
108-
err: {
109+
notify: {
109110
group: 'dashboard',
110111
type: 'error',
111112
text: "Could not connect your Discord account!",
@@ -118,7 +119,7 @@
118119
this.$router.push({
119120
name: "login",
120121
params: {
121-
err: {
122+
notify: {
122123
group: 'auth',
123124
type: 'error',
124125
text: "Unauthorized!",

src/components/auth/oauth/google/Callback.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
this.$store.dispatch("OAUTHCallback", {
6767
service: "google",
6868
code: this.$route.query.code,
69+
ref,
6970
}).then(() => {
7071
7172
this.loading = false;
@@ -106,7 +107,7 @@
106107
this.$router.push({
107108
name: "settings",
108109
params: {
109-
err: {
110+
notify: {
110111
group: 'dashboard',
111112
type: 'error',
112113
text: "Could not connect your Google account!",
@@ -119,7 +120,7 @@
119120
this.$router.push({
120121
name: "login",
121122
params: {
122-
err: {
123+
notify: {
123124
group: 'auth',
124125
type: 'error',
125126
text: "Unauthorized!",

src/components/auth/oauth/spotify/Callback.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
this.$store.dispatch("OAUTHCallback", {
6767
service: "spotify",
6868
code: this.$route.query.code,
69+
ref,
6970
}).then(() => {
7071
7172
this.loading = false;
@@ -106,7 +107,7 @@
106107
this.$router.push({
107108
name: "settings",
108109
params: {
109-
err: {
110+
notify: {
110111
group: 'dashboard',
111112
type: 'error',
112113
text: "Could not connect your Spotify account!",
@@ -119,7 +120,7 @@
119120
this.$router.push({
120121
name: "login",
121122
params: {
122-
err: {
123+
notify: {
123124
group: 'auth',
124125
type: 'error',
125126
text: "Unauthorized!",

src/components/dashboard/Dashboard.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@
398398
this.$bus.$on('stop-progress-bar', () => {
399399
this.$refs.topProgress.done();
400400
});
401-
let err = this.$route.params.err;
402-
if (err != null){
403-
this.$notify(err);
401+
let notify = this.$route.params.notify;
402+
if (notify != null){
403+
this.$notify(notify);
404404
}
405405
}
406406
}

src/store/store.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ export const store = new Vuex.Store({
433433
}).then(resolve).catch(reject);
434434
})
435435
},
436-
OAUTHCallback(context, {service, code}) {
436+
OAUTHCallback(context, {service, code, ref}) {
437437
return new Promise((resolve, reject) => {
438438

439439
const params = new URLSearchParams();
@@ -447,8 +447,10 @@ export const store = new Vuex.Store({
447447
}
448448

449449
axios.post(`/oauth/${service}/@callback`, params, {headers}).then(response => {
450-
const {token, refreshed_token} = response.data.result;
451-
context.commit('retrieveToken', {token, refreshed_token});
450+
if (ref === 'dashboard') {
451+
const {token, refreshed_token} = response.data.result;
452+
context.commit('retrieveToken', {token, refreshed_token});
453+
}
452454
resolve(response);
453455
}).catch(reject);
454456

0 commit comments

Comments
 (0)