From 2f4b3272da6aeebf6414399a56695b713ea03f75 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 30 Jan 2020 11:27:54 +0000 Subject: [PATCH] Send initial device display najme on register Fixes https://github.com/vector-im/riot-web/issues/12140 --- src/components/structures/MatrixChat.js | 1 + .../structures/auth/Registration.js | 20 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 233ec9e7bb..d6ef3341da 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1985,6 +1985,7 @@ export default createReactClass({ onLoggedIn={this.onRegisterFlowComplete} onLoginClick={this.onLoginClick} onServerConfigChange={this.onServerConfigChange} + defaultDeviceDisplayName={this.props.defaultDeviceDisplayName} {...this.getServerProperties()} /> ); diff --git a/src/components/structures/auth/Registration.js b/src/components/structures/auth/Registration.js index 171d3ada26..8593a4b1e2 100644 --- a/src/components/structures/auth/Registration.js +++ b/src/components/structures/auth/Registration.js @@ -2,7 +2,7 @@ Copyright 2015, 2016 OpenMarket Ltd Copyright 2017 Vector Creations Ltd Copyright 2018, 2019 New Vector Ltd -Copyright 2019 The Matrix.org Foundation C.I.C. +Copyright 2019, 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -62,6 +62,7 @@ export default createReactClass({ // registration shouldn't know or care how login is done. onLoginClick: PropTypes.func.isRequired, onServerConfigChange: PropTypes.func.isRequired, + defaultDeviceDisplayName: PropTypes.string, }, getInitialState: function() { @@ -432,15 +433,14 @@ export default createReactClass({ // session). if (!this.state.formVals.password) inhibitLogin = null; - return this.state.matrixClient.register( - this.state.formVals.username, - this.state.formVals.password, - undefined, // session id: included in the auth dict already - auth, - null, - null, - inhibitLogin, - ); + const registerParams = { + username: this.state.formVals.username, + password: this.state.formVals.password, + initial_device_display_name: this.props.defaultDeviceDisplayName, + }; + if (auth) registerParams.auth = auth; + if (inhibitLogin !== undefined && inhibitLogin !== null) registerParams.inhibitLogin = inhibitLogin; + return this.state.matrixClient.registerRequest(registerParams); }, _getUIAuthInputs: function() {