Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sso): add email domain precheck sso flow #1111

Draft
wants to merge 1 commit into
base: develop_tchap
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions linked-dependencies/matrix-react-sdk/src/Views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ enum Views {

// Another instance of the application has started up. We just show an error page.
LOCK_STOLEN,

// :TCHAP: screen before launching sso
EMAIL_PRECHECK_SSO
}

export default Views;
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ import { checkSessionLockFree, getSessionLock } from "../../utils/SessionLock";
import { SessionLockStolenView } from "./auth/SessionLockStolenView";
import { ConfirmSessionLockTheftView } from "./auth/ConfirmSessionLockTheftView";
import { LoginSplashView } from "./auth/LoginSplashView";
import TchapUrls from "../../../../../src/tchap/util/TchapUrls"; // :TCHAP: activate-cross-signing-and-secure-storage-react
import { cleanUpDraftsIfRequired } from "../../DraftCleaner";

import TchapUrls from "../../../../../src/tchap/util/TchapUrls"; // :TCHAP: activate-cross-signing-and-secure-storage-react
import EmailVerificationPage from "../../../../../src/tchap/components/views/sso/EmailVerificationPage"; // :TCHAP: sso-agentconnect-flow

// legacy export
export { default as Views } from "../../Views";

Expand Down Expand Up @@ -946,6 +948,15 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
true,
);
break;
// :TCHAP: sso-agentconnect-flow
case Action.EmailPrecheckSSO:
if (Lifecycle.isSoftLogout()) {
this.onSoftLogout();
break;
}
this.viewEmailPrecheckSSO();
break;
// end :TCHAP:
}
};

Expand Down Expand Up @@ -1104,6 +1115,17 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
this.themeWatcher.recheck();
}

// :TCHAP: sso-agentconnect-flow
private viewEmailPrecheckSSO() {
this.setStateForNewView({
view: Views.EMAIL_PRECHECK_SSO
});
this.notifyNewScreen("email-precheck-sso");
ThemeController.isLogin = true;
this.themeWatcher.recheck();
}
// end :TCHAP:

private viewHome(justRegistered = false): void {
// The home page requires the "logged in" view, so we'll set that.
this.setStateForNewView({
Expand Down Expand Up @@ -1875,6 +1897,13 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
userId: userId,
subAction: params?.action,
});
// :TCHAP: sso-agentconnect-flow
} else if (screen = "email-precheck-sso") {
dis.dispatch({
action: "email_precheck_sso",
params
});
// end :TCHAP:
} else {
logger.info(`Ignoring showScreen for '${screen}'`);
}
Expand Down Expand Up @@ -2137,6 +2166,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
view = <UseCaseSelection onFinished={(useCase): Promise<void> => this.onShowPostLoginScreen(useCase)} />;
} else if (this.state.view === Views.LOCK_STOLEN) {
view = <SessionLockStolenView />;
// :TCHAP: sso-agentconnect-flow
} else if (this.state.view === Views.EMAIL_PRECHECK_SSO) {
view = <EmailVerificationPage />;
// end :TCHAP:
} else {
logger.error(`Unknown view ${this.state.view}`);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,9 @@ export enum Action {
* Opens right panel room summary and focuses the search input
*/
FocusMessageSearch = "focus_search",

/**
* :TCHAP: Open new page to check email instance before launching SSO
*/
EmailPrecheckSSO = "email_precheck_sso"
}
3 changes: 3 additions & 0 deletions res/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ <h1 class="mx_Header_title">_t("Welcome to Tchap")<br />
</a>
</div>
<div class="mx_ButtonRow">
<a href="#/email-precheck-sso" class="mx_ButtonParent mx_ButtonSignIn mx_Button_iconSignIn">
<div class="mx_ButtonLabel">Pro Connect</div>
</a>
<a href="#/login" class="mx_ButtonParent mx_ButtonSignIn mx_Button_iconSignIn">
<div class="mx_ButtonLabel">_t("action|sign_in")</div>
</a>
Expand Down
Loading