Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6125 from matrix-org/t3chguy/fix/17521
Browse files Browse the repository at this point in the history
Switch to stable endpoint/fields for MSC2858
  • Loading branch information
t3chguy authored Jun 1, 2021
2 parents 173b0e9 + 4526998 commit 72fab80
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ interface IPasswordFlow {
}

export enum IdentityProviderBrand {
Gitlab = "org.matrix.gitlab",
Github = "org.matrix.github",
Apple = "org.matrix.apple",
Google = "org.matrix.google",
Facebook = "org.matrix.facebook",
Twitter = "org.matrix.twitter",
Gitlab = "gitlab",
Github = "github",
Apple = "apple",
Google = "google",
Facebook = "facebook",
Twitter = "twitter",
}

export interface IIdentityProvider {
Expand All @@ -48,7 +48,8 @@ export interface IIdentityProvider {

export interface ISSOFlow {
type: "m.login.sso" | "m.login.cas";
"org.matrix.msc2858.identity_providers": IIdentityProvider[]; // Unstable prefix for MSC2858
// eslint-disable-next-line camelcase
identity_providers: IIdentityProvider[];
}

export type LoginFlow = ISSOFlow | IPasswordFlow;
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export default class Registration extends React.Component<IProps, IState> {
let ssoSection;
if (this.state.ssoFlow) {
let continueWithSection;
const providers = this.state.ssoFlow["org.matrix.msc2858.identity_providers"] || [];
const providers = this.state.ssoFlow.identity_providers || [];
// when there is only a single (or 0) providers we show a wide button with `Continue with X` text
if (providers.length > 1) {
// i18n: ssoButtons is a placeholder to help translators understand context
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/elements/SSOButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ interface IProps {
const MAX_PER_ROW = 6;

const SSOButtons: React.FC<IProps> = ({matrixClient, flow, loginType, fragmentAfterLogin, primary}) => {
const providers = flow["org.matrix.msc2858.identity_providers"] || [];
const providers = flow.identity_providers || [];
if (providers.length < 2) {
return <div className="mx_SSOButtons">
<SSOButton
Expand Down
2 changes: 1 addition & 1 deletion test/components/structures/auth/Login-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('Login', function() {
root.setState({
flows: [{
"type": "m.login.sso",
"org.matrix.msc2858.identity_providers": [{
"identity_providers": [{
id: "a",
name: "Provider 1",
}, {
Expand Down

0 comments on commit 72fab80

Please sign in to comment.