mirror of https://github.com/vector-im/riot-web
Merge pull request #3299 from matrix-org/t3chguy/fix_registrationForm_defaultValue_Field
RegistrationForm: the Fields are controlled, fix default valuespull/21833/head
commit
76f5977a2a
|
@ -2,6 +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 Michael Telatynski <7t3chguy@gmail.com>
|
||||||
|
|
||||||
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.
|
||||||
|
@ -69,10 +70,10 @@ module.exports = React.createClass({
|
||||||
fieldValid: {},
|
fieldValid: {},
|
||||||
// The ISO2 country code selected in the phone number entry
|
// The ISO2 country code selected in the phone number entry
|
||||||
phoneCountry: this.props.defaultPhoneCountry,
|
phoneCountry: this.props.defaultPhoneCountry,
|
||||||
username: "",
|
username: this.props.defaultUsername || "",
|
||||||
email: "",
|
email: this.props.defaultEmail || "",
|
||||||
phoneNumber: "",
|
phoneNumber: this.props.defaultPhoneNumber || "",
|
||||||
password: "",
|
password: this.props.defaultPassword || "",
|
||||||
passwordConfirm: "",
|
passwordConfirm: "",
|
||||||
passwordComplexity: null,
|
passwordComplexity: null,
|
||||||
passwordSafe: false,
|
passwordSafe: false,
|
||||||
|
@ -90,7 +91,7 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
if (this.state.email == '') {
|
if (this.state.email === '') {
|
||||||
const haveIs = Boolean(this.props.serverConfig.isUrl);
|
const haveIs = Boolean(this.props.serverConfig.isUrl);
|
||||||
|
|
||||||
let desc;
|
let desc;
|
||||||
|
@ -455,7 +456,6 @@ module.exports = React.createClass({
|
||||||
ref={field => this[FIELD_EMAIL] = field}
|
ref={field => this[FIELD_EMAIL] = field}
|
||||||
type="text"
|
type="text"
|
||||||
label={emailPlaceholder}
|
label={emailPlaceholder}
|
||||||
defaultValue={this.props.defaultEmail}
|
|
||||||
value={this.state.email}
|
value={this.state.email}
|
||||||
onChange={this.onEmailChange}
|
onChange={this.onEmailChange}
|
||||||
onValidate={this.onEmailValidate}
|
onValidate={this.onEmailValidate}
|
||||||
|
@ -469,7 +469,6 @@ module.exports = React.createClass({
|
||||||
ref={field => this[FIELD_PASSWORD] = field}
|
ref={field => this[FIELD_PASSWORD] = field}
|
||||||
type="password"
|
type="password"
|
||||||
label={_t("Password")}
|
label={_t("Password")}
|
||||||
defaultValue={this.props.defaultPassword}
|
|
||||||
value={this.state.password}
|
value={this.state.password}
|
||||||
onChange={this.onPasswordChange}
|
onChange={this.onPasswordChange}
|
||||||
onValidate={this.onPasswordValidate}
|
onValidate={this.onPasswordValidate}
|
||||||
|
@ -483,7 +482,6 @@ module.exports = React.createClass({
|
||||||
ref={field => this[FIELD_PASSWORD_CONFIRM] = field}
|
ref={field => this[FIELD_PASSWORD_CONFIRM] = field}
|
||||||
type="password"
|
type="password"
|
||||||
label={_t("Confirm")}
|
label={_t("Confirm")}
|
||||||
defaultValue={this.props.defaultPassword}
|
|
||||||
value={this.state.passwordConfirm}
|
value={this.state.passwordConfirm}
|
||||||
onChange={this.onPasswordConfirmChange}
|
onChange={this.onPasswordConfirmChange}
|
||||||
onValidate={this.onPasswordConfirmValidate}
|
onValidate={this.onPasswordConfirmValidate}
|
||||||
|
@ -512,7 +510,6 @@ module.exports = React.createClass({
|
||||||
ref={field => this[FIELD_PHONE_NUMBER] = field}
|
ref={field => this[FIELD_PHONE_NUMBER] = field}
|
||||||
type="text"
|
type="text"
|
||||||
label={phoneLabel}
|
label={phoneLabel}
|
||||||
defaultValue={this.props.defaultPhoneNumber}
|
|
||||||
value={this.state.phoneNumber}
|
value={this.state.phoneNumber}
|
||||||
prefix={phoneCountry}
|
prefix={phoneCountry}
|
||||||
onChange={this.onPhoneNumberChange}
|
onChange={this.onPhoneNumberChange}
|
||||||
|
@ -528,7 +525,6 @@ module.exports = React.createClass({
|
||||||
type="text"
|
type="text"
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
label={_t("Username")}
|
label={_t("Username")}
|
||||||
defaultValue={this.props.defaultUsername}
|
|
||||||
value={this.state.username}
|
value={this.state.username}
|
||||||
onChange={this.onUsernameChange}
|
onChange={this.onUsernameChange}
|
||||||
onValidate={this.onUsernameValidate}
|
onValidate={this.onUsernameValidate}
|
||||||
|
|
Loading…
Reference in New Issue