Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3399269
D11393.id38439.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11393.id38439.diff
View Options
diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -530,14 +530,25 @@
) => Promise<IdentityAuthResult> {
const client = React.useContext(IdentityClientContext);
const identityClient = client?.identityClient;
+ const preRequestUserState = useSelector(state => state.currentUserInfo);
+
return React.useCallback(
(username, password) => {
if (!identityClient) {
throw new Error('Identity service client is not initialized');
}
- return identityClient.logInPasswordUser(username, password);
+ return (async () => {
+ const result = await identityClient.logInPasswordUser(
+ username,
+ password,
+ );
+ return {
+ ...result,
+ preRequestUserState: preRequestUserState,
+ };
+ })();
},
- [identityClient],
+ [identityClient, preRequestUserState],
);
}
function useIdentityWalletLogIn(): (
diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -13,6 +13,10 @@
type OlmSessionInitializationInfo,
olmSessionInitializationInfoValidator,
} from './request-types.js';
+import {
+ currentUserInfoValidator,
+ type CurrentUserInfo,
+} from './user-types.js';
import { tShape } from '../utils/validation-utils.js';
export type UserAuthMetadata = {
@@ -152,12 +156,14 @@
+userID: string,
+accessToken: string,
+username: string,
+ +preRequestUserState?: ?CurrentUserInfo,
};
export const identityAuthResultValidator: TInterface<IdentityAuthResult> =
tShape<IdentityAuthResult>({
userID: t.String,
accessToken: t.String,
username: t.String,
+ preRequestUserState: t.maybe(currentUserInfoValidator),
});
export type IdentityNewDeviceKeyUpload = {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 2:46 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609853
Default Alt Text
D11393.id38439.diff (1 KB)
Attached To
Mode
D11393: [lib] Add preRequestUserState to identity login
Attached
Detach File
Event Timeline
Log In to Comment