From cc74a09abdbcd88bcf5010facfc0274bc9bcdb76 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 8 Jun 2017 20:57:05 +0100 Subject: [PATCH] Remove start_upgrade_registration dispatch handler This dispatch is no longer raised anywhere, so we may as well get rid of the code that it executes, as well as the state which is only set there. --- src/components/structures/MatrixChat.js | 28 ------------------- .../structures/login/Registration.js | 20 +------------ .../views/login/RegistrationForm.js | 15 ++-------- src/i18n/strings/de_DE.json | 2 -- src/i18n/strings/el.json | 1 - src/i18n/strings/en_EN.json | 2 -- src/i18n/strings/en_US.json | 2 -- src/i18n/strings/fr.json | 2 -- src/i18n/strings/pt.json | 2 -- src/i18n/strings/pt_BR.json | 2 -- src/i18n/strings/ru.json | 2 -- src/i18n/strings/sv.json | 1 - src/i18n/strings/th.json | 2 -- 13 files changed, 3 insertions(+), 78 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index bde6396074..1065fa9f9f 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -128,11 +128,6 @@ module.exports = React.createClass({ hasNewVersion: false, newVersionReleaseNotes: null, - // The username to default to when upgrading an account from a guest - upgradeUsername: null, - // The access token we had for our guest account, used when upgrading to a normal account - guestAccessToken: null, - // Parameters used in the registration dance with the IS register_client_secret: null, register_session_id: null, @@ -315,8 +310,6 @@ module.exports = React.createClass({ viewUserId: null, loggedIn: false, ready: false, - upgradeUsername: null, - guestAccessToken: null, }; Object.assign(newState, state); this.setState(newState); @@ -351,25 +344,6 @@ module.exports = React.createClass({ screen: 'post_registration', }); break; - case 'start_upgrade_registration': - // also stash our credentials, then if we restore the session, - // we can just do it the same way whether we started upgrade - // registration or explicitly logged out - this.setStateForNewScreen({ - guestCreds: MatrixClientPeg.getCredentials(), - screen: "register", - upgradeUsername: MatrixClientPeg.get().getUserIdLocalpart(), - guestAccessToken: MatrixClientPeg.get().getAccessToken(), - }); - - // stop the client: if we are syncing whilst the registration - // is completed in another browser, we'll be 401ed for using - // a guest access token for a non-guest account. - // It will be restarted in onReturnToGuestClick - Lifecycle.stopMatrixClient(); - - this.notifyNewScreen('register'); - break; case 'start_password_recovery': this.setStateForNewScreen({ screen: 'forgot_password', @@ -1401,8 +1375,6 @@ module.exports = React.createClass({ idSid={this.state.register_id_sid} email={this.props.startingFragmentQueryParams.email} referrer={this.props.startingFragmentQueryParams.referrer} - username={this.state.upgradeUsername} - guestAccessToken={this.state.guestAccessToken} defaultHsUrl={this.getDefaultHsUrl()} defaultIsUrl={this.getDefaultIsUrl()} brand={this.props.config.brand} diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index 943376cb8e..17fbf445b2 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -45,8 +45,6 @@ module.exports = React.createClass({ brand: React.PropTypes.string, email: React.PropTypes.string, referrer: React.PropTypes.string, - username: React.PropTypes.string, - guestAccessToken: React.PropTypes.string, teamServerConfig: React.PropTypes.shape({ // Email address to request new teams supportEmail: React.PropTypes.string.isRequired, @@ -295,17 +293,6 @@ module.exports = React.createClass({ }, _makeRegisterRequest: function(auth) { - let guestAccessToken = this.props.guestAccessToken; - - if ( - this.state.formVals.username !== this.props.username || - this.state.hsUrl != this.props.defaultHsUrl - ) { - // don't try to upgrade if we changed our username - // or are registering on a different HS - guestAccessToken = null; - } - // Only send the bind params if we're sending username / pw params // (Since we need to send no params at all to use the ones saved in the // session). @@ -320,7 +307,7 @@ module.exports = React.createClass({ undefined, // session id: included in the auth dict already auth, bindThreepids, - guestAccessToken, + null, ); }, @@ -357,10 +344,6 @@ module.exports = React.createClass({ } else if (this.state.busy || this.state.teamServerBusy) { registerBody = ; } else { - let guestUsername = this.props.username; - if (this.state.hsUrl != this.props.defaultHsUrl) { - guestUsername = null; - } let errorSection; if (this.state.errorText) { errorSection =
{this.state.errorText}
; @@ -374,7 +357,6 @@ module.exports = React.createClass({ defaultPhoneNumber={this.state.formVals.phoneNumber} defaultPassword={this.state.formVals.password} teamsConfig={this.state.teamsConfig} - guestUsername={guestUsername} minPasswordLength={MIN_PASSWORD_LENGTH} onError={this.onFormValidationFailed} onRegisterClick={this.onFormSubmit} diff --git a/src/components/views/login/RegistrationForm.js b/src/components/views/login/RegistrationForm.js index 0ca4615a84..ff07cd36e5 100644 --- a/src/components/views/login/RegistrationForm.js +++ b/src/components/views/login/RegistrationForm.js @@ -54,11 +54,6 @@ module.exports = React.createClass({ })).required, }), - // A username that will be used if no username is entered. - // Specifying this param will also warn the user that entering - // a different username will cause a fresh account to be generated. - guestUsername: React.PropTypes.string, - minPasswordLength: React.PropTypes.number, onError: React.PropTypes.func, onRegisterClick: React.PropTypes.func.isRequired, // onRegisterClick(Object) => ?Promise @@ -123,7 +118,7 @@ module.exports = React.createClass({ _doSubmit: function(ev) { let email = this.refs.email.value.trim(); var promise = this.props.onRegisterClick({ - username: this.refs.username.value.trim() || this.props.guestUsername, + username: this.refs.username.value.trim(), password: this.refs.password.value.trim(), email: email, phoneCountry: this.state.phoneCountry, @@ -191,7 +186,7 @@ module.exports = React.createClass({ break; case FIELD_USERNAME: // XXX: SPEC-1 - var username = this.refs.username.value.trim() || this.props.guestUsername; + var username = this.refs.username.value.trim(); if (encodeURIComponent(username) != username) { this.markFieldValid( field_id, @@ -339,9 +334,6 @@ module.exports = React.createClass({ ); let placeholderUserName = _t("User name"); - if (this.props.guestUsername) { - placeholderUserName += " " + _t("(default: %(userName)s)", {userName: this.props.guestUsername}); - } return (
@@ -354,9 +346,6 @@ module.exports = React.createClass({ className={this._classForField(FIELD_USERNAME, 'mx_Login_field')} onBlur={function() {self.validateField(FIELD_USERNAME);}} />
- { this.props.guestUsername ? -
{_t("Setting a user name will create a fresh account")}
: null - } disabled URL previews by default.": "Vous avez désactivé les aperçus d’URL par défaut.", "You have enabled URL previews by default.": "Vous avez activé les aperçus d’URL par défaut.", diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index 2197f5b71a..7ce73f8310 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -858,7 +858,6 @@ "Anyone": "Qualquer pessoa", "Are you sure you want to leave the room '%(roomName)s'?": "Você tem certeza que deseja sair da sala '%(roomName)s'?", "Custom level": "Nível personalizado", - "(default: %(userName)s)": "(padrão: %(userName)s)", "Device ID:": "ID do dispositivo:", "device id: ": "id do dispositivo: ", "Device key:": "Chave do dispositivo:", @@ -869,7 +868,6 @@ "Register": "Registre-se", "Remote addresses for this room:": "Endereços remotos para esta sala:", "Save": "Salvar", - "Setting a user name will create a fresh account": "Definir um nome de usuária(o) vai criar uma conta nova", "Tagged as: ": "Marcado como: ", "You have disabled URL previews by default.": "Você desabilitou pré-visualizações de links por padrão.", "You have enabled URL previews by default.": "Você habilitou pré-visualizações de links por padrão.", diff --git a/src/i18n/strings/pt_BR.json b/src/i18n/strings/pt_BR.json index 635752f811..95e29c45ec 100644 --- a/src/i18n/strings/pt_BR.json +++ b/src/i18n/strings/pt_BR.json @@ -858,7 +858,6 @@ "Anyone": "Qualquer pessoa", "Are you sure you want to leave the room '%(roomName)s'?": "Você tem certeza que deseja sair da sala '%(roomName)s'?", "Custom level": "Nível personalizado", - "(default: %(userName)s)": "(padrão: %(userName)s)", "Device ID:": "ID do dispositivo:", "device id: ": "id do dispositivo: ", "Device key:": "Chave do dispositivo:", @@ -869,7 +868,6 @@ "Register": "Registre-se", "Remote addresses for this room:": "Endereços remotos para esta sala:", "Save": "Salvar", - "Setting a user name will create a fresh account": "Definir um nome de usuária(o) vai criar uma conta nova", "Tagged as: ": "Marcado como: ", "You have disabled URL previews by default.": "Você desabilitou pré-visualizações de links por padrão.", "You have enabled URL previews by default.": "Você habilitou pré-visualizações de links por padrão.", diff --git a/src/i18n/strings/ru.json b/src/i18n/strings/ru.json index c77ad2d477..6e4179fa24 100644 --- a/src/i18n/strings/ru.json +++ b/src/i18n/strings/ru.json @@ -684,7 +684,6 @@ "%(senderDisplayName)s removed the room name.": "%(senderDisplayName)s удалил имя комнаты.", "Changing password will currently reset any end-to-end encryption keys on all devices, making encrypted chat history unreadable, unless you first export your room keys and re-import them afterwards. In future this will be improved.": "Смена пароля также сбросит все ключи шифрования на всех устройствах, сделав зашифрованную историю недоступной, если только вы сначала не экспортируете ключи шифрования и не импортируете их потом. В будущем это будет исправлено.", "Custom level": "Пользовательский уровень", - "(default: %(userName)s)": "(по-умолчанию: %(userName)s)", "Device already verified!": "Устройство уже верифицировано!", "Device ID:": "ID устройства:", "device id: ": "id устройства: ", @@ -727,7 +726,6 @@ "Session ID": "ID сессии", "%(senderName)s set a profile picture.": "%(senderName)s установил картинку профиля.", "%(senderName)s set their display name to %(displayName)s.": "%(senderName)s установил отображаемое имя %(displayName)s.", - "Setting a user name will create a fresh account": "Установка имени пользователя создаст новую учетную запись", "Signed Out": "Вышли", "Sorry, this homeserver is using a login which is not recognised ": "Извините, этот Home Server использует логин, который не удалось распознать ", "Tagged as: ": "Теги: ", diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index 789d5adbca..a5d8b2980d 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -221,7 +221,6 @@ "decline": "avböj", "Decrypt %(text)s": "Dekryptera %(text)s", "Decryption error": "Dekrypteringsfel", - "(default: %(userName)s)": "(standard: %(userName)s)", "Delete": "Radera", "demote": "degradera", "Deops user with given id": "Degraderar användaren med givet id", diff --git a/src/i18n/strings/th.json b/src/i18n/strings/th.json index 940f79b72b..edc197a1af 100644 --- a/src/i18n/strings/th.json +++ b/src/i18n/strings/th.json @@ -22,7 +22,6 @@ "Create Room": "สรัางห้อง", "Delete": "ลบ", "Default": "ค่าเริ่มต้น", - "(default: %(userName)s)": "(ค่าเริ่มต้น: %(userName)s)", "Default Device": "อุปกรณ์เริ่มต้น", "%(senderName)s banned %(targetName)s.": "%(senderName)s แบน %(targetName)s แล้ว", "%(senderDisplayName)s changed the topic to \"%(topic)s\".": "%(senderDisplayName)s เปลี่ยนหัวข้อเป็น \"%(topic)s\"", @@ -295,7 +294,6 @@ "Server unavailable, overloaded, or something else went wrong.": "เซิร์ฟเวอร์อาจไม่พร้อมใช้งาน ทำงานหนักเกินไป หรือบางอย่างผิดปกติ", "%(senderName)s set a profile picture.": "%(senderName)s ตั้งรูปโปรไฟล์", "%(senderName)s set their display name to %(displayName)s.": "%(senderName)s ตั้งชื่อที่แสดงเป็น %(displayName)s", - "Setting a user name will create a fresh account": "การตั้งชื่อผู้ใช้จะสร้างบัญชีใหม่", "Show panel": "แสดงหน้าต่าง", "Signed Out": "ออกจากระบบแล้ว", "Sign in": "เข้าสู่ระบบ",