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

Social Login and login delight tweaks #5426

Merged
merged 24 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc3542a
Extend Platform to support idpId for SSO flows
t3chguy Nov 19, 2020
a1351ea
Increase Dialog button mixin border-radius to 8px
t3chguy Nov 20, 2020
6f6e850
lowercase username placeholder in Password Login and Registration Form
t3chguy Nov 23, 2020
2263280
Improve no email warning during registration
t3chguy Nov 23, 2020
613710b
Iterate Auth copy
t3chguy Nov 23, 2020
1d53a5c
Initial support for MSC2858
t3chguy Nov 23, 2020
b1ca1eb
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Nov 24, 2020
f7d7182
Iterate Multi-SSO support
t3chguy Nov 24, 2020
2f64160
Remove backwards compatibility in ServerConfig for m.require_identity…
t3chguy Nov 24, 2020
225d541
Extend Field and InfoDialog with more configurability
t3chguy Nov 25, 2020
6a315e8
Improve auth error messages
t3chguy Nov 25, 2020
758b47c
Replace *ServerConfig and SignInToText with ServerPicker
t3chguy Nov 25, 2020
1b1c482
Iterate tests
t3chguy Nov 25, 2020
c408419
delint
t3chguy Nov 25, 2020
3bdedd7
fix another test
t3chguy Nov 25, 2020
8602545
Remove unused dialog, todo comments and other tiny tweaks
t3chguy Nov 26, 2020
5f03cbd
Iterate PR some more
t3chguy Nov 26, 2020
26e1cdb
Update i18n
t3chguy Dec 1, 2020
ba542f2
Merge branch 'develop' into t3chguy/socials
t3chguy Dec 1, 2020
eb25c39
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Dec 1, 2020
e0b6844
i18n
t3chguy Dec 1, 2020
d8e46c7
Merge remote-tracking branch 'origin/t3chguy/socials' into t3chguy/so…
t3chguy Dec 1, 2020
3fda7e3
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Dec 2, 2020
8593845
i18n
t3chguy Dec 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
@import "./views/elements/_RichText.scss";
@import "./views/elements/_RoleButton.scss";
@import "./views/elements/_RoomAliasField.scss";
@import "./views/elements/_SSOButtons.scss";
@import "./views/elements/_Slider.scss";
@import "./views/elements/_Spinner.scss";
@import "./views/elements/_StyledCheckbox.scss";
Expand Down
6 changes: 0 additions & 6 deletions res/css/structures/auth/_Login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ limitations under the License.
cursor: default;
}

.mx_AuthBody a.mx_Login_sso_link:link,
.mx_AuthBody a.mx_Login_sso_link:hover,
.mx_AuthBody a.mx_Login_sso_link:visited {
color: $button-primary-fg-color;
}

.mx_Login_loader {
display: inline;
position: relative;
Expand Down
41 changes: 41 additions & 0 deletions res/css/views/elements/_SSOButtons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_SSOButtons {
display: flex;
justify-content: center;

.mx_SSOButton {
position: relative;

> img {
object-fit: contain;
position: absolute;
left: 12px;
top: 12px;
}
}

.mx_SSOButton_mini {
box-sizing: border-box;
width: 50px; // 48px + 1px border on all sides
height: 50px; // 48px + 1px border on all sides

& + .mx_SSOButton_mini {
margin-left: 24px;
}
}
}
37 changes: 18 additions & 19 deletions src/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,24 @@ interface ILoginOptions {

// TODO: Move this to JS SDK
interface ILoginFlow {
type: string;
type: "m.login.password" | "m.login.cas";
}

export interface IIdentityProvider {
id: string;
name: string;
icon?: string;
}

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

export type LoginFlow = ISSOFlow | ILoginFlow;

// TODO: Move this to JS SDK
/* eslint-disable camelcase */
interface ILoginParams {
Expand All @@ -48,9 +63,8 @@ export default class Login {
private hsUrl: string;
private isUrl: string;
private fallbackHsUrl: string;
private currentFlowIndex: number;
// TODO: Flows need a type in JS SDK
private flows: Array<ILoginFlow>;
private flows: Array<LoginFlow>;
private defaultDeviceDisplayName: string;
private tempClient: MatrixClient;

Expand All @@ -63,7 +77,6 @@ export default class Login {
this.hsUrl = hsUrl;
this.isUrl = isUrl;
this.fallbackHsUrl = fallbackHsUrl;
this.currentFlowIndex = 0;
this.flows = [];
this.defaultDeviceDisplayName = opts.defaultDeviceDisplayName;
this.tempClient = null; // memoize
Expand Down Expand Up @@ -100,27 +113,13 @@ export default class Login {
});
}

public async getFlows(): Promise<Array<ILoginFlow>> {
public async getFlows(): Promise<Array<LoginFlow>> {
const client = this.createTemporaryClient();
const { flows } = await client.loginFlows();
this.flows = flows;
this.currentFlowIndex = 0;
// technically the UI should display options for all flows for the
// user to then choose one, so return all the flows here.
return this.flows;
}

public chooseFlow(flowIndex): void {
this.currentFlowIndex = flowIndex;
}

public getCurrentFlowStep(): string {
// technically the flow can have multiple steps, but no one does this
// for login so we can ignore it.
const flowStep = this.flows[this.currentFlowIndex];
return flowStep ? flowStep.type : null;
}

public loginViaPassword(
username: string,
phoneCountry: string,
Expand Down
Loading