diff --git a/src/app/pages/auth/MasAccountNotice.tsx b/src/app/pages/auth/MasAccountNotice.tsx
new file mode 100644
index 00000000..b8f506b4
--- /dev/null
+++ b/src/app/pages/auth/MasAccountNotice.tsx
@@ -0,0 +1,11 @@
+import { Text } from 'folds';
+import React from 'react';
+
+export function MasAccountNotice({ url }: { url: string }) {
+ return (
+
+ Accounts here are managed by your sign-in service. Create or recover an account on its{' '}
+ account page.
+
+ );
+}
diff --git a/src/app/pages/auth/login/Login.tsx b/src/app/pages/auth/login/Login.tsx
index ea08e4f0..05204779 100644
--- a/src/app/pages/auth/login/Login.tsx
+++ b/src/app/pages/auth/login/Login.tsx
@@ -15,6 +15,10 @@ import { getLoginPath, getRegisterPath, withSearchParam } from '../../pathUtils'
import { usePathWithOrigin } from '../../../hooks/usePathWithOrigin';
import { LoginPathSearchParams } from '../../paths';
import { useClientConfig } from '../../../hooks/useClientConfig';
+import { useMasAccountUrl } from '../masAccount';
+import { MasAccountNotice } from '../MasAccountNotice';
+import { SoftLogoutNotice } from './SoftLogoutNotice';
+import { useSoftLogout } from '../../../state/softLogout';
import { noSignInMethodMessage } from '../authMessages';
const getLoginTokenSearchParam = () => {
@@ -57,12 +61,15 @@ export function Login() {
}
const parsedFlows = useParsedLoginFlows(loginFlows.flows);
+ const masUrl = useMasAccountUrl();
+ const softLogout = useSoftLogout();
return (
Login
+ {softLogout && }
{parsedFlows.token && loginSearchParams.loginToken && (
)}
@@ -93,9 +100,9 @@ export function Login() {
>
)}
- {registrationEntry(config) ? (
-
- ) : (
+ {masUrl && }
+ {!masUrl && registrationEntry(config) && }
+ {!masUrl && !registrationEntry(config) && (
Do not have an account? Register
diff --git a/src/app/pages/auth/login/PasswordLoginForm.tsx b/src/app/pages/auth/login/PasswordLoginForm.tsx
index 6372684c..63c28577 100644
--- a/src/app/pages/auth/login/PasswordLoginForm.tsx
+++ b/src/app/pages/auth/login/PasswordLoginForm.tsx
@@ -19,7 +19,7 @@ import {
} from 'folds';
import FocusTrap from 'focus-trap-react';
import { Link } from 'react-router-dom';
-import { MatrixError } from 'matrix-js-sdk';
+import { LoginRequest, MatrixError } from 'matrix-js-sdk';
import { getMxIdLocalPart, getMxIdServer, isUserId } from '../../../utils/matrix';
import { EMAIL_REGEX } from '../../../utils/regex';
import { useAutoDiscoveryInfo } from '../../../hooks/useAutoDiscoveryInfo';
@@ -39,6 +39,8 @@ import { loginErrorMessage } from '../authMessages';
import { ForgotLink } from '../styles.css';
import { getResetPasswordPath } from '../../pathUtils';
import { stopPropagation } from '../../../utils/keyboard';
+import { useSoftLogout, withSoftLogoutDevice } from '../../../state/softLogout';
+import { useMasAccountUrl } from '../masAccount';
import { PhoneHit } from '../../../styles/PhoneHit.css';
function UsernameHint({ server }: { server: string }) {
@@ -118,6 +120,10 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
const server = useAuthServer();
const clientConfig = useClientConfig();
+ const softLogout = useSoftLogout();
+ const masUrl = useMasAccountUrl();
+ const withDevice = (request: LoginRequest) => withSoftLogoutDevice(request, softLogout);
+
const serverDiscovery = useAutoDiscoveryInfo();
const baseUrl = serverDiscovery['m.homeserver'].base_url;
@@ -130,15 +136,18 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
useLoginComplete(loginState.status === AsyncStatus.Success ? loginState.data : undefined);
const handleUsernameLogin = (username: string, password: string) => {
- startLogin(baseUrl, {
- type: 'm.login.password',
- identifier: {
- type: 'm.id.user',
- user: username,
- },
- password,
- initial_device_display_name: 'Ratatoskr Web',
- });
+ startLogin(
+ baseUrl,
+ withDevice({
+ type: 'm.login.password',
+ identifier: {
+ type: 'm.id.user',
+ user: username,
+ },
+ password,
+ initial_device_display_name: 'Ratatoskr Web',
+ })
+ );
};
const handleMxIdLogin = async (mxId: string, password: string) => {
@@ -148,27 +157,33 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
const getBaseUrl = factoryGetBaseUrl(clientConfig, mxIdServer);
- startLogin(getBaseUrl, {
- type: 'm.login.password',
- identifier: {
- type: 'm.id.user',
- user: mxIdUsername,
- },
- password,
- initial_device_display_name: 'Ratatoskr Web',
- });
+ startLogin(
+ getBaseUrl,
+ withDevice({
+ type: 'm.login.password',
+ identifier: {
+ type: 'm.id.user',
+ user: mxIdUsername,
+ },
+ password,
+ initial_device_display_name: 'Ratatoskr Web',
+ })
+ );
};
const handleEmailLogin = (email: string, password: string) => {
- startLogin(baseUrl, {
- type: 'm.login.password',
- identifier: {
- type: 'm.id.thirdparty',
- medium: 'email',
- address: email,
- },
- password,
- initial_device_display_name: 'Ratatoskr Web',
- });
+ startLogin(
+ baseUrl,
+ withDevice({
+ type: 'm.login.password',
+ identifier: {
+ type: 'm.id.thirdparty',
+ medium: 'email',
+ address: email,
+ },
+ password,
+ initial_device_display_name: 'Ratatoskr Web',
+ })
+ );
};
const handleSubmit: FormEventHandler = (evt) => {
@@ -207,7 +222,8 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog
Username
)}
-
-
-
- Forget Password?
-
-
-
+ {!masUrl && (
+
+
+
+ Forget Password?
+
+
+
+ )}