Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3555486
D10817.id36761.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10817.id36761.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
@@ -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
Details
Attached
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)
Attached To
Mode
D10817: [lib] add identity password log in action
Attached
Detach File
Event Timeline
Log In to Comment