Fix login provider custom name not showing up on login page
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
0ee3ac9da5
commit
cdf7533fdc
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<a
|
<a
|
||||||
class="button is-light"
|
class="button is-light"
|
||||||
v-if="Object.keys(SELECTED_PROVIDERS).includes(oauthProvider.id)"
|
v-if="isProviderSelected && oauthProvider.label === null"
|
||||||
:href="`/auth/${oauthProvider.id}`"
|
:href="`/auth/${oauthProvider.id}`"
|
||||||
>
|
>
|
||||||
<b-icon :icon="oauthProvider.id" />
|
<b-icon :icon="oauthProvider.id" />
|
||||||
<span>{{ SELECTED_PROVIDERS[oauthProvider.id] }}</span></a
|
<span>{{ SELECTED_PROVIDERS[oauthProvider.id] }}</span></a
|
||||||
>
|
>
|
||||||
<a class="button is-light" :href="`/auth/${oauthProvider.id}`" v-else>
|
<a class="button is-light" :href="`/auth/${oauthProvider.id}`" v-else-if="isProviderSelected">
|
||||||
<b-icon icon="lock" />
|
<b-icon icon="lock" />
|
||||||
<span>{{ oauthProvider.label }}</span>
|
<span>{{ oauthProvider.label }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -22,5 +22,9 @@ export default class AuthProvider extends Vue {
|
||||||
@Prop({ required: true, type: Object }) oauthProvider!: IOAuthProvider;
|
@Prop({ required: true, type: Object }) oauthProvider!: IOAuthProvider;
|
||||||
|
|
||||||
SELECTED_PROVIDERS = SELECTED_PROVIDERS;
|
SELECTED_PROVIDERS = SELECTED_PROVIDERS;
|
||||||
|
|
||||||
|
get isProviderSelected(): boolean {
|
||||||
|
return Object.keys(SELECTED_PROVIDERS).includes(this.oauthProvider.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import { InstanceTermsType, InstancePrivacyType } from "./admin.model";
|
import { InstanceTermsType, InstancePrivacyType } from "./admin.model";
|
||||||
import { IProvider } from "./resource";
|
import { IProvider } from "./resource";
|
||||||
|
|
||||||
|
export interface IOAuthProvider {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IConfig {
|
export interface IConfig {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
@ -82,8 +87,3 @@ export interface IConfig {
|
||||||
oauthProviders: IOAuthProvider[];
|
oauthProviders: IOAuthProvider[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOAuthProvider {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
}
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ export default class Login extends Vue {
|
||||||
await initializeCurrentActor(this.$apollo.provider.defaultClient);
|
await initializeCurrentActor(this.$apollo.provider.defaultClient);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof NoIdentitiesException) {
|
if (err instanceof NoIdentitiesException) {
|
||||||
return this.$router.push({
|
this.$router.push({
|
||||||
name: RouteName.REGISTER_PROFILE,
|
name: RouteName.REGISTER_PROFILE,
|
||||||
params: {
|
params: {
|
||||||
email: this.currentUser.email,
|
email: this.currentUser.email,
|
||||||
|
@ -220,17 +220,16 @@ export default class Login extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.redirect) {
|
if (this.redirect) {
|
||||||
return this.$router.push(this.redirect);
|
this.$router.push(this.redirect);
|
||||||
}
|
}
|
||||||
window.localStorage.setItem("welcome-back", "yes");
|
window.localStorage.setItem("welcome-back", "yes");
|
||||||
return this.$router.push({ name: RouteName.HOME });
|
this.$router.push({ name: RouteName.HOME });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.submitted = false;
|
this.submitted = false;
|
||||||
console.error(err);
|
console.error(err);
|
||||||
err.graphQLErrors.forEach(({ message }: { message: string }) => {
|
err.graphQLErrors.forEach(({ message }: { message: string }) => {
|
||||||
this.errors.push(message);
|
this.errors.push(message);
|
||||||
});
|
});
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue