Merge branch 'fix-login-provider-custom-name' into 'master'

Fix login provider custom name not showing up on login page

See merge request framasoft/mobilizon!669
This commit is contained in:
Thomas Citharel 2020-10-29 10:44:00 +01:00
commit c9b9f946d3
3 changed files with 14 additions and 11 deletions

View File

@ -1,13 +1,13 @@
<template>
<a
class="button is-light"
v-if="Object.keys(SELECTED_PROVIDERS).includes(oauthProvider.id)"
v-if="isProviderSelected && oauthProvider.label === null"
:href="`/auth/${oauthProvider.id}`"
>
<b-icon :icon="oauthProvider.id" />
<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" />
<span>{{ oauthProvider.label }}</span>
</a>
@ -22,5 +22,9 @@ export default class AuthProvider extends Vue {
@Prop({ required: true, type: Object }) oauthProvider!: IOAuthProvider;
SELECTED_PROVIDERS = SELECTED_PROVIDERS;
get isProviderSelected(): boolean {
return Object.keys(SELECTED_PROVIDERS).includes(this.oauthProvider.id);
}
}
</script>

View File

@ -1,6 +1,11 @@
import { InstanceTermsType, InstancePrivacyType } from "./admin.model";
import { IProvider } from "./resource";
export interface IOAuthProvider {
id: string;
label: string;
}
export interface IConfig {
name: string;
description: string;
@ -82,8 +87,3 @@ export interface IConfig {
oauthProviders: IOAuthProvider[];
};
}
export interface IOAuthProvider {
id: string;
label: string;
}

View File

@ -209,7 +209,7 @@ export default class Login extends Vue {
await initializeCurrentActor(this.$apollo.provider.defaultClient);
} catch (err) {
if (err instanceof NoIdentitiesException) {
return this.$router.push({
this.$router.push({
name: RouteName.REGISTER_PROFILE,
params: {
email: this.currentUser.email,
@ -220,17 +220,16 @@ export default class Login extends Vue {
}
if (this.redirect) {
return this.$router.push(this.redirect);
this.$router.push(this.redirect);
}
window.localStorage.setItem("welcome-back", "yes");
return this.$router.push({ name: RouteName.HOME });
this.$router.push({ name: RouteName.HOME });
} catch (err) {
this.submitted = false;
console.error(err);
err.graphQLErrors.forEach(({ message }: { message: string }) => {
this.errors.push(message);
});
return undefined;
}
}
}