Page MenuHomePhabricator

D10817.id36761.diff
No OneTemporary

D10817.id36761.diff

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
@@ -444,11 +444,27 @@
calendarQuery: CalendarQuery,
};
-const tempIdentityLoginActionTypes = Object.freeze({
- started: 'TEMP_IDENTITY_LOG_IN_STARTED',
- success: 'TEMP_IDENTITY_LOG_IN_SUCCESS',
- failed: 'TEMP_IDENTITY_LOG_IN_FAILED',
+const identityLogInActionTypes = Object.freeze({
+ started: 'IDENTITY_LOG_IN_STARTED',
+ success: 'IDENTITY_LOG_IN_SUCCESS',
+ failed: 'IDENTITY_LOG_IN_FAILED',
});
+function useIdentityPasswordLogIn(): (
+ username: string,
+ password: string,
+) => Promise<IdentityAuthResult> {
+ const client = React.useContext(IdentityClientContext);
+ const identityClient = client?.identityClient;
+ return React.useCallback(
+ (username, password) => {
+ if (!identityClient) {
+ throw new Error('Identity service client is not initialized');
+ }
+ return identityClient.logInPasswordUser(username, password);
+ },
+ [identityClient],
+ );
+}
const logInActionTypes = Object.freeze({
started: 'LOG_IN_STARTED',
@@ -741,7 +757,8 @@
getOlmSessionInitializationData,
mergeUserInfos,
logIn as logInRawAction,
- tempIdentityLoginActionTypes,
+ identityLogInActionTypes,
+ useIdentityPasswordLogIn,
useLogIn,
logInActionTypes,
useLogOut,
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -342,19 +342,19 @@
+loadingInfo: LoadingInfo,
}
| {
- +type: 'TEMP_IDENTITY_LOG_IN_STARTED',
+ +type: 'IDENTITY_LOG_IN_STARTED',
+loadingInfo: LoadingInfo,
+payload?: void,
}
| {
- +type: 'TEMP_IDENTITY_LOG_IN_FAILED',
+ +type: 'IDENTITY_LOG_IN_FAILED',
+error: true,
+payload: Error,
+loadingInfo: LoadingInfo,
}
| {
- +type: 'TEMP_IDENTITY_LOG_IN_SUCCESS',
- +payload?: void,
+ +type: 'IDENTITY_LOG_IN_SUCCESS',
+ +payload: IdentityAuthResult,
+loadingInfo: LoadingInfo,
}
| {

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 10:41 PM (6 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2721462
Default Alt Text
D10817.id36761.diff (2 KB)

Event Timeline