Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Send the correct UIA alongside the wrong UIA for backwards comaptibility #3211

Merged
merged 4 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/components/views/auth/InteractiveAuthEntryComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ export const PasswordAuthEntry = React.createClass({

this.props.submitAuthDict({
type: PasswordAuthEntry.LOGIN_TYPE,
// TODO: Remove `user` once servers support proper UIA
// See https://github.com/vector-im/riot-web/issues/10312
user: this.props.matrixClient.credentials.userId,
identifier: {
type: "m.id.user",
user: this.props.matrixClient.credentials.userId,
},
password: this.state.password,
});
},
Expand Down Expand Up @@ -463,11 +469,18 @@ export const MsisdnAuthEntry = React.createClass({
);
this.props.submitAuthDict({
type: MsisdnAuthEntry.LOGIN_TYPE,
// TODO: Remove `threepid_creds` once servers support proper UIA
// See https://github.com/vector-im/riot-web/issues/10312
threepid_creds: {
sid: this._sid,
client_secret: this.props.clientSecret,
id_server: idServerParsedUrl.host,
},
threepidCreds: {
sid: this._sid,
client_secret: this.props.clientSecret,
id_server: idServerParsedUrl.host,
},
});
} else {
this.setState({
Expand Down
6 changes: 6 additions & 0 deletions src/components/views/dialogs/DeactivateAccountDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ export default class DeactivateAccountDialog extends React.Component {
// for this endpoint. In reality it could be any UI auth.
const auth = {
type: 'm.login.password',
// TODO: Remove `user` once servers support proper UIA
// See https://github.com/vector-im/riot-web/issues/10312
user: MatrixClientPeg.get().credentials.userId,
identifier: {
type: "m.id.user",
user: MatrixClientPeg.get().credentials.userId,
},
password: this.state.password,
};
await MatrixClientPeg.get().deactivateAccount(auth, this.state.shouldErase);
Expand Down
7 changes: 5 additions & 2 deletions test/components/views/dialogs/InteractiveAuthDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ describe('InteractiveAuthDialog', function() {
ReactTestUtils.Simulate.submit(formNode, {});

expect(doRequest.callCount).toEqual(1);
expect(doRequest.calledWithExactly({
expect(doRequest.calledWithMatch({
session: "sess",
type: "m.login.password",
password: "s3kr3t",
user: "@user:id",
identifier: {
type: "m.id.user",
user: "@user:id",
},
})).toBe(true);
// let the request complete
return Promise.delay(1);
Expand Down