Skip to content

Commit 7f978be

Browse files
committed
Support for MSC2457 logout_devices param for setPassword()
1 parent 781fdf4 commit 7f978be

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/client.ts

+21-1
Original file line numberDiff line numberDiff line change
@@ -7815,15 +7815,35 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
78157815
* Make a request to change your password.
78167816
* @param {Object} authDict
78177817
* @param {string} newPassword The new desired password.
7818+
* @param {boolean} logoutDevices Should all sessions be logged out after the password change. Defaults to true.
78187819
* @param {module:client.callback} callback Optional.
78197820
* @return {Promise} Resolves: TODO
78207821
* @return {module:http-api.MatrixError} Rejects: with an error response.
78217822
*/
7822-
public setPassword(authDict: any, newPassword: string, callback?: Callback): Promise<any> { // TODO: Types
7823+
public setPassword(
7824+
authDict: any,
7825+
newPassword: string,
7826+
logoutDevices: boolean,
7827+
callback?: Callback
7828+
): Promise<any>;
7829+
public setPassword(
7830+
authDict: any,
7831+
newPassword: string,
7832+
logoutDevices?: Callback | boolean,
7833+
callback?: Callback,
7834+
): Promise<any> { // TODO: Types
7835+
if (typeof logoutDevices !== 'boolean') {
7836+
logoutDevices = true;
7837+
}
7838+
if (typeof logoutDevices === 'function') {
7839+
callback = logoutDevices;
7840+
}
7841+
78237842
const path = "/account/password";
78247843
const data = {
78257844
'auth': authDict,
78267845
'new_password': newPassword,
7846+
'logout_devices': logoutDevices,
78277847
};
78287848

78297849
return this.http.authedRequest(

0 commit comments

Comments
 (0)