Page MenuHomePhabricator

D10623.id41459.diff
No OneTemporary

D10623.id41459.diff

diff --git a/native/profile/edit-password.react.js b/native/profile/edit-password.react.js
--- a/native/profile/edit-password.react.js
+++ b/native/profile/edit-password.react.js
@@ -14,6 +14,8 @@
import {
changeKeyserverUserPasswordActionTypes,
changeKeyserverUserPassword,
+ useChangeIdentityUserPassword,
+ changeIdentityUserPasswordActionTypes,
} from 'lib/actions/user-actions.js';
import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
@@ -23,6 +25,7 @@
useDispatchActionPromise,
type DispatchActionPromise,
} from 'lib/utils/redux-promise-utils.js';
+import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js';
import type { ProfileNavigationProp } from './profile.react.js';
import { setNativeCredentials } from '../account/native-credentials.js';
@@ -107,6 +110,10 @@
+changeKeyserverUserPassword: (
passwordUpdate: PasswordUpdate,
) => Promise<void>,
+ +changeIdentityUserPassword: (
+ oldPassword: string,
+ newPassword: string,
+ ) => Promise<void>,
};
type State = {
+currentPassword: string,
@@ -276,6 +283,11 @@
);
} else if (this.state.newPassword === this.state.currentPassword) {
this.goBackOnce();
+ } else if (usingCommServicesAccessToken) {
+ void this.props.dispatchActionPromise(
+ changeIdentityUserPasswordActionTypes,
+ this.savePassword(),
+ );
} else {
void this.props.dispatchActionPromise(
changeKeyserverUserPasswordActionTypes,
@@ -290,12 +302,19 @@
return;
}
try {
- await this.props.changeKeyserverUserPassword({
- updatedFields: {
- password: this.state.newPassword,
- },
- currentPassword: this.state.currentPassword,
- });
+ if (usingCommServicesAccessToken) {
+ await this.props.changeIdentityUserPassword(
+ this.state.currentPassword,
+ this.state.newPassword,
+ );
+ } else {
+ await this.props.changeKeyserverUserPassword({
+ updatedFields: {
+ password: this.state.newPassword,
+ },
+ currentPassword: this.state.currentPassword,
+ });
+ }
await setNativeCredentials({
username,
password: this.state.newPassword,
@@ -339,9 +358,9 @@
};
}
-const loadingStatusSelector = createLoadingStatusSelector(
- changeKeyserverUserPasswordActionTypes,
-);
+const loadingStatusSelector = usingCommServicesAccessToken
+ ? createLoadingStatusSelector(changeIdentityUserPasswordActionTypes)
+ : createLoadingStatusSelector(changeKeyserverUserPasswordActionTypes);
const ConnectedEditPassword: React.ComponentType<BaseProps> =
React.memo<BaseProps>(function ConnectedEditPassword(props: BaseProps) {
@@ -359,6 +378,7 @@
const callChangeKeyserverUserPassword = useLegacyAshoatKeyserverCall(
changeKeyserverUserPassword,
);
+ const callChangeIdentityUserPassword = useChangeIdentityUserPassword();
return (
<EditPassword
@@ -369,6 +389,7 @@
styles={styles}
dispatchActionPromise={dispatchActionPromise}
changeKeyserverUserPassword={callChangeKeyserverUserPassword}
+ changeIdentityUserPassword={callChangeIdentityUserPassword}
/>
);
});

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 5, 11:08 PM (21 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2246778
Default Alt Text
D10623.id41459.diff (3 KB)

Event Timeline