diff --git a/src/components/LoginPage.vue b/src/components/LoginPage.vue
index 72c111c2..a026cb4f 100644
--- a/src/components/LoginPage.vue
+++ b/src/components/LoginPage.vue
@@ -28,6 +28,11 @@
+
@@ -44,9 +49,16 @@ export default {
return {
username: null,
password: null,
+ oidcProviders: null,
};
},
mounted() {
+ const session = this.$route.query.session;
+ if (session) {
+ this.setPreference("authToken" + this.hashCode(this.authApiUrl()), session);
+ this.$router.push("/");
+ }
+ this.fetchConfig();
//TODO: Add Server Side check
if (this.getAuthToken()) {
this.$router.push("/");
@@ -56,6 +68,16 @@ export default {
document.title = this.$t("titles.login") + " - Piped";
},
methods: {
+ async fetchConfig() {
+ this.fetchJson(this.apiUrl() + "/config").then(config => {
+ this.oidcProviders = config?.oidcProviders.map(name => {
+ return {
+ name,
+ authUri: `${this.authApiUrl()}/oidc/${name}/login?redirect=${window.location.origin}/login`,
+ };
+ });
+ });
+ },
login() {
if (!this.username || !this.password) return;
this.fetchJson(this.authApiUrl() + "/login", null, {
diff --git a/src/components/PreferencesPage.vue b/src/components/PreferencesPage.vue
index 059e2399..bd185720 100644
--- a/src/components/PreferencesPage.vue
+++ b/src/components/PreferencesPage.vue
@@ -502,6 +502,7 @@ export default {
document.title = this.$t("titles.preferences") + " - Piped";
},
async mounted() {
+ if (this.$route.query.deleted == this.getAuthToken()) this.logout();
if (Object.keys(this.$route.query).length > 0) this.$router.replace({ query: {} });
this.fetchJson("https://piped-instances.kavin.rocks/").then(resp => {
@@ -647,7 +648,8 @@ export default {
}),
}).then(resp => {
if (!resp.error) {
- this.logout();
+ const redirect = resp.redirect;
+ redirect ? (location.href = redirect) : this.logout();
} else alert(resp.error);
});
},