Merge pull request #3992 from matrix-org/dbkr/default_display_name_register

Send initial device display name on register
This commit is contained in:
David Baker 2020-01-30 11:53:29 +00:00 committed by GitHub
commit e43de26720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 10 deletions

View file

@ -1985,6 +1985,7 @@ export default createReactClass({
onLoggedIn={this.onRegisterFlowComplete} onLoggedIn={this.onRegisterFlowComplete}
onLoginClick={this.onLoginClick} onLoginClick={this.onLoginClick}
onServerConfigChange={this.onServerConfigChange} onServerConfigChange={this.onServerConfigChange}
defaultDeviceDisplayName={this.props.defaultDeviceDisplayName}
{...this.getServerProperties()} {...this.getServerProperties()}
/> />
); );

View file

@ -2,7 +2,7 @@
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd Copyright 2017 Vector Creations Ltd
Copyright 2018, 2019 New Vector 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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with 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. // registration shouldn't know or care how login is done.
onLoginClick: PropTypes.func.isRequired, onLoginClick: PropTypes.func.isRequired,
onServerConfigChange: PropTypes.func.isRequired, onServerConfigChange: PropTypes.func.isRequired,
defaultDeviceDisplayName: PropTypes.string,
}, },
getInitialState: function() { getInitialState: function() {
@ -432,15 +433,14 @@ export default createReactClass({
// session). // session).
if (!this.state.formVals.password) inhibitLogin = null; if (!this.state.formVals.password) inhibitLogin = null;
return this.state.matrixClient.register( const registerParams = {
this.state.formVals.username, username: this.state.formVals.username,
this.state.formVals.password, password: this.state.formVals.password,
undefined, // session id: included in the auth dict already initial_device_display_name: this.props.defaultDeviceDisplayName,
auth, };
null, if (auth) registerParams.auth = auth;
null, if (inhibitLogin !== undefined && inhibitLogin !== null) registerParams.inhibitLogin = inhibitLogin;
inhibitLogin, return this.state.matrixClient.registerRequest(registerParams);
);
}, },
_getUIAuthInputs: function() { _getUIAuthInputs: function() {