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.
This commit is contained in:
Richard van der Hoff 2017-06-08 20:57:05 +01:00
parent e6d7eedbe6
commit cc74a09abd
13 changed files with 3 additions and 78 deletions

View file

@ -128,11 +128,6 @@ module.exports = React.createClass({
hasNewVersion: false, hasNewVersion: false,
newVersionReleaseNotes: null, 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 // Parameters used in the registration dance with the IS
register_client_secret: null, register_client_secret: null,
register_session_id: null, register_session_id: null,
@ -315,8 +310,6 @@ module.exports = React.createClass({
viewUserId: null, viewUserId: null,
loggedIn: false, loggedIn: false,
ready: false, ready: false,
upgradeUsername: null,
guestAccessToken: null,
}; };
Object.assign(newState, state); Object.assign(newState, state);
this.setState(newState); this.setState(newState);
@ -351,25 +344,6 @@ module.exports = React.createClass({
screen: 'post_registration', screen: 'post_registration',
}); });
break; 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': case 'start_password_recovery':
this.setStateForNewScreen({ this.setStateForNewScreen({
screen: 'forgot_password', screen: 'forgot_password',
@ -1401,8 +1375,6 @@ module.exports = React.createClass({
idSid={this.state.register_id_sid} idSid={this.state.register_id_sid}
email={this.props.startingFragmentQueryParams.email} email={this.props.startingFragmentQueryParams.email}
referrer={this.props.startingFragmentQueryParams.referrer} referrer={this.props.startingFragmentQueryParams.referrer}
username={this.state.upgradeUsername}
guestAccessToken={this.state.guestAccessToken}
defaultHsUrl={this.getDefaultHsUrl()} defaultHsUrl={this.getDefaultHsUrl()}
defaultIsUrl={this.getDefaultIsUrl()} defaultIsUrl={this.getDefaultIsUrl()}
brand={this.props.config.brand} brand={this.props.config.brand}

View file

@ -45,8 +45,6 @@ module.exports = React.createClass({
brand: React.PropTypes.string, brand: React.PropTypes.string,
email: React.PropTypes.string, email: React.PropTypes.string,
referrer: React.PropTypes.string, referrer: React.PropTypes.string,
username: React.PropTypes.string,
guestAccessToken: React.PropTypes.string,
teamServerConfig: React.PropTypes.shape({ teamServerConfig: React.PropTypes.shape({
// Email address to request new teams // Email address to request new teams
supportEmail: React.PropTypes.string.isRequired, supportEmail: React.PropTypes.string.isRequired,
@ -295,17 +293,6 @@ module.exports = React.createClass({
}, },
_makeRegisterRequest: function(auth) { _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 // 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 // (Since we need to send no params at all to use the ones saved in the
// session). // session).
@ -320,7 +307,7 @@ module.exports = React.createClass({
undefined, // session id: included in the auth dict already undefined, // session id: included in the auth dict already
auth, auth,
bindThreepids, bindThreepids,
guestAccessToken, null,
); );
}, },
@ -357,10 +344,6 @@ module.exports = React.createClass({
} else if (this.state.busy || this.state.teamServerBusy) { } else if (this.state.busy || this.state.teamServerBusy) {
registerBody = <Spinner />; registerBody = <Spinner />;
} else { } else {
let guestUsername = this.props.username;
if (this.state.hsUrl != this.props.defaultHsUrl) {
guestUsername = null;
}
let errorSection; let errorSection;
if (this.state.errorText) { if (this.state.errorText) {
errorSection = <div className="mx_Login_error">{this.state.errorText}</div>; errorSection = <div className="mx_Login_error">{this.state.errorText}</div>;
@ -374,7 +357,6 @@ module.exports = React.createClass({
defaultPhoneNumber={this.state.formVals.phoneNumber} defaultPhoneNumber={this.state.formVals.phoneNumber}
defaultPassword={this.state.formVals.password} defaultPassword={this.state.formVals.password}
teamsConfig={this.state.teamsConfig} teamsConfig={this.state.teamsConfig}
guestUsername={guestUsername}
minPasswordLength={MIN_PASSWORD_LENGTH} minPasswordLength={MIN_PASSWORD_LENGTH}
onError={this.onFormValidationFailed} onError={this.onFormValidationFailed}
onRegisterClick={this.onFormSubmit} onRegisterClick={this.onFormSubmit}

View file

@ -54,11 +54,6 @@ module.exports = React.createClass({
})).required, })).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, minPasswordLength: React.PropTypes.number,
onError: React.PropTypes.func, onError: React.PropTypes.func,
onRegisterClick: React.PropTypes.func.isRequired, // onRegisterClick(Object) => ?Promise onRegisterClick: React.PropTypes.func.isRequired, // onRegisterClick(Object) => ?Promise
@ -123,7 +118,7 @@ module.exports = React.createClass({
_doSubmit: function(ev) { _doSubmit: function(ev) {
let email = this.refs.email.value.trim(); let email = this.refs.email.value.trim();
var promise = this.props.onRegisterClick({ 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(), password: this.refs.password.value.trim(),
email: email, email: email,
phoneCountry: this.state.phoneCountry, phoneCountry: this.state.phoneCountry,
@ -191,7 +186,7 @@ module.exports = React.createClass({
break; break;
case FIELD_USERNAME: case FIELD_USERNAME:
// XXX: SPEC-1 // XXX: SPEC-1
var username = this.refs.username.value.trim() || this.props.guestUsername; var username = this.refs.username.value.trim();
if (encodeURIComponent(username) != username) { if (encodeURIComponent(username) != username) {
this.markFieldValid( this.markFieldValid(
field_id, field_id,
@ -339,9 +334,6 @@ module.exports = React.createClass({
); );
let placeholderUserName = _t("User name"); let placeholderUserName = _t("User name");
if (this.props.guestUsername) {
placeholderUserName += " " + _t("(default: %(userName)s)", {userName: this.props.guestUsername});
}
return ( return (
<div> <div>
@ -354,9 +346,6 @@ module.exports = React.createClass({
className={this._classForField(FIELD_USERNAME, 'mx_Login_field')} className={this._classForField(FIELD_USERNAME, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_USERNAME);}} /> onBlur={function() {self.validateField(FIELD_USERNAME);}} />
<br /> <br />
{ this.props.guestUsername ?
<div className="mx_Login_fieldLabel">{_t("Setting a user name will create a fresh account")}</div> : null
}
<input type="password" ref="password" <input type="password" ref="password"
className={this._classForField(FIELD_PASSWORD, 'mx_Login_field')} className={this._classForField(FIELD_PASSWORD, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_PASSWORD);}} onBlur={function() {self.validateField(FIELD_PASSWORD);}}

View file

@ -849,7 +849,6 @@
"Anyone": "Jeder", "Anyone": "Jeder",
"Are you sure you want to leave the room '%(roomName)s'?": "Bist du sicher, dass du den Raum '%(roomName)s' verlassen willst?", "Are you sure you want to leave the room '%(roomName)s'?": "Bist du sicher, dass du den Raum '%(roomName)s' verlassen willst?",
"Custom level": "Benutzerdefiniertes Berechtigungslevel", "Custom level": "Benutzerdefiniertes Berechtigungslevel",
"(default: %(userName)s)": "(Standard: %(userName)s)",
"Device ID:": "Geräte-ID:", "Device ID:": "Geräte-ID:",
"device id: ": "Geräte-ID: ", "device id: ": "Geräte-ID: ",
"Device key:": "Geräte-Schlüssel:", "Device key:": "Geräte-Schlüssel:",
@ -859,7 +858,6 @@
"Password:": "Passwort:", "Password:": "Passwort:",
"Register": "Registrieren", "Register": "Registrieren",
"Save": "Speichern", "Save": "Speichern",
"Setting a user name will create a fresh account": "Die Eingabe eines Benutzernamens wird ein neues Konto erzeugen",
"Tagged as: ": "Markiert als: ", "Tagged as: ": "Markiert als: ",
"This Home Server does not support login using email address.": "Dieser Heimserver unterstützt den Login mittels E-Mail-Adresse nicht.", "This Home Server does not support login using email address.": "Dieser Heimserver unterstützt den Login mittels E-Mail-Adresse nicht.",
"There was a problem logging in.": "Es gab ein Problem beim anmelden.", "There was a problem logging in.": "Es gab ein Problem beim anmelden.",

View file

@ -212,7 +212,6 @@
"decline": "απόρριψη", "decline": "απόρριψη",
"Decrypt %(text)s": "Αποκρυπτογράφησε %(text)s", "Decrypt %(text)s": "Αποκρυπτογράφησε %(text)s",
"Decryption error": "Σφάλμα αποκρυπτογράφησης", "Decryption error": "Σφάλμα αποκρυπτογράφησης",
"(default: %(userName)s)": "(προεπιλογή: %(userName)s)",
"Delete": "Διαγραφή", "Delete": "Διαγραφή",
"Default": "Προεπιλογή", "Default": "Προεπιλογή",
"Device already verified!": "Η συσκευή έχει ήδη επαληθευτεί!", "Device already verified!": "Η συσκευή έχει ήδη επαληθευτεί!",

View file

@ -236,7 +236,6 @@
"Decline": "Decline", "Decline": "Decline",
"Decrypt %(text)s": "Decrypt %(text)s", "Decrypt %(text)s": "Decrypt %(text)s",
"Decryption error": "Decryption error", "Decryption error": "Decryption error",
"(default: %(userName)s)": "(default: %(userName)s)",
"Delete": "Delete", "Delete": "Delete",
"demote": "demote", "demote": "demote",
"Deops user with given id": "Deops user with given id", "Deops user with given id": "Deops user with given id",
@ -506,7 +505,6 @@
"%(senderName)s set a profile picture.": "%(senderName)s set a profile picture.", "%(senderName)s set a profile picture.": "%(senderName)s set a profile picture.",
"%(senderName)s set their display name to %(displayName)s.": "%(senderName)s set their display name to %(displayName)s.", "%(senderName)s set their display name to %(displayName)s.": "%(senderName)s set their display name to %(displayName)s.",
"Set": "Set", "Set": "Set",
"Setting a user name will create a fresh account": "Setting a user name will create a fresh account",
"Settings": "Settings", "Settings": "Settings",
"Show panel": "Show panel", "Show panel": "Show panel",
"Show Text Formatting Toolbar": "Show Text Formatting Toolbar", "Show Text Formatting Toolbar": "Show Text Formatting Toolbar",

View file

@ -224,7 +224,6 @@
"decline": "decline", "decline": "decline",
"Decrypt %(text)s": "Decrypt %(text)s", "Decrypt %(text)s": "Decrypt %(text)s",
"Decryption error": "Decryption error", "Decryption error": "Decryption error",
"(default: %(userName)s)": "(default: %(userName)s)",
"Delete": "Delete", "Delete": "Delete",
"demote": "demote", "demote": "demote",
"Deops user with given id": "Deops user with given id", "Deops user with given id": "Deops user with given id",
@ -464,7 +463,6 @@
"Session ID": "Session ID", "Session ID": "Session ID",
"%(senderName)s set a profile picture.": "%(senderName)s set a profile picture.", "%(senderName)s set a profile picture.": "%(senderName)s set a profile picture.",
"%(senderName)s set their display name to %(displayName)s.": "%(senderName)s set their display name to %(displayName)s.", "%(senderName)s set their display name to %(displayName)s.": "%(senderName)s set their display name to %(displayName)s.",
"Setting a user name will create a fresh account": "Setting a user name will create a fresh account",
"Settings": "Settings", "Settings": "Settings",
"Show panel": "Show panel", "Show panel": "Show panel",
"Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)", "Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)",

View file

@ -808,7 +808,6 @@
"Anyone": "N'importe qui", "Anyone": "N'importe qui",
"Are you sure you want to leave the room '%(roomName)s'?": "Êtes-vous sûr de vouloir quitter le salon '%(roomName)s' ?", "Are you sure you want to leave the room '%(roomName)s'?": "Êtes-vous sûr de vouloir quitter le salon '%(roomName)s' ?",
"Custom level": "Niveau personnalisé", "Custom level": "Niveau personnalisé",
"(default: %(userName)s)": "(défaut : %(userName)s)",
"Device ID:": "Identifiant de l'appareil :", "Device ID:": "Identifiant de l'appareil :",
"device id: ": "Identifiant appareil : ", "device id: ": "Identifiant appareil : ",
"Device key:": "Clé de lappareil :", "Device key:": "Clé de lappareil :",
@ -819,7 +818,6 @@
"Register": "S'inscrire", "Register": "S'inscrire",
"Remote addresses for this room:": "Supprimer l'adresse pour ce salon :", "Remote addresses for this room:": "Supprimer l'adresse pour ce salon :",
"Save": "Enregistrer", "Save": "Enregistrer",
"Setting a user name will create a fresh account": "Définir un nouveau nom dutilisateur va créer un nouveau compte",
"Tagged as: ": "Étiquetter comme : ", "Tagged as: ": "Étiquetter comme : ",
"You have <a>disabled</a> URL previews by default.": "Vous avez <a>désactivé</a> les aperçus dURL par défaut.", "You have <a>disabled</a> URL previews by default.": "Vous avez <a>désactivé</a> les aperçus dURL par défaut.",
"You have <a>enabled</a> URL previews by default.": "Vous avez <a>activé</a> les aperçus dURL par défaut.", "You have <a>enabled</a> URL previews by default.": "Vous avez <a>activé</a> les aperçus dURL par défaut.",

View file

@ -858,7 +858,6 @@
"Anyone": "Qualquer pessoa", "Anyone": "Qualquer pessoa",
"Are you sure you want to leave the room '%(roomName)s'?": "Você tem certeza que deseja sair da sala '%(roomName)s'?", "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", "Custom level": "Nível personalizado",
"(default: %(userName)s)": "(padrão: %(userName)s)",
"Device ID:": "ID do dispositivo:", "Device ID:": "ID do dispositivo:",
"device id: ": "id do dispositivo: ", "device id: ": "id do dispositivo: ",
"Device key:": "Chave do dispositivo:", "Device key:": "Chave do dispositivo:",
@ -869,7 +868,6 @@
"Register": "Registre-se", "Register": "Registre-se",
"Remote addresses for this room:": "Endereços remotos para esta sala:", "Remote addresses for this room:": "Endereços remotos para esta sala:",
"Save": "Salvar", "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: ", "Tagged as: ": "Marcado como: ",
"You have <a>disabled</a> URL previews by default.": "Você <a>desabilitou</a> pré-visualizações de links por padrão.", "You have <a>disabled</a> URL previews by default.": "Você <a>desabilitou</a> pré-visualizações de links por padrão.",
"You have <a>enabled</a> URL previews by default.": "Você <a>habilitou</a> pré-visualizações de links por padrão.", "You have <a>enabled</a> URL previews by default.": "Você <a>habilitou</a> pré-visualizações de links por padrão.",

View file

@ -858,7 +858,6 @@
"Anyone": "Qualquer pessoa", "Anyone": "Qualquer pessoa",
"Are you sure you want to leave the room '%(roomName)s'?": "Você tem certeza que deseja sair da sala '%(roomName)s'?", "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", "Custom level": "Nível personalizado",
"(default: %(userName)s)": "(padrão: %(userName)s)",
"Device ID:": "ID do dispositivo:", "Device ID:": "ID do dispositivo:",
"device id: ": "id do dispositivo: ", "device id: ": "id do dispositivo: ",
"Device key:": "Chave do dispositivo:", "Device key:": "Chave do dispositivo:",
@ -869,7 +868,6 @@
"Register": "Registre-se", "Register": "Registre-se",
"Remote addresses for this room:": "Endereços remotos para esta sala:", "Remote addresses for this room:": "Endereços remotos para esta sala:",
"Save": "Salvar", "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: ", "Tagged as: ": "Marcado como: ",
"You have <a>disabled</a> URL previews by default.": "Você <a>desabilitou</a> pré-visualizações de links por padrão.", "You have <a>disabled</a> URL previews by default.": "Você <a>desabilitou</a> pré-visualizações de links por padrão.",
"You have <a>enabled</a> URL previews by default.": "Você <a>habilitou</a> pré-visualizações de links por padrão.", "You have <a>enabled</a> URL previews by default.": "Você <a>habilitou</a> pré-visualizações de links por padrão.",

View file

@ -684,7 +684,6 @@
"%(senderDisplayName)s removed the room name.": "%(senderDisplayName)s удалил имя комнаты.", "%(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.": "Смена пароля также сбросит все ключи шифрования на всех устройствах, сделав зашифрованную историю недоступной, если только вы сначала не экспортируете ключи шифрования и не импортируете их потом. В будущем это будет исправлено.", "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": "Пользовательский уровень", "Custom level": "Пользовательский уровень",
"(default: %(userName)s)": "(по-умолчанию: %(userName)s)",
"Device already verified!": "Устройство уже верифицировано!", "Device already verified!": "Устройство уже верифицировано!",
"Device ID:": "ID устройства:", "Device ID:": "ID устройства:",
"device id: ": "id устройства: ", "device id: ": "id устройства: ",
@ -727,7 +726,6 @@
"Session ID": "ID сессии", "Session ID": "ID сессии",
"%(senderName)s set a profile picture.": "%(senderName)s установил картинку профиля.", "%(senderName)s set a profile picture.": "%(senderName)s установил картинку профиля.",
"%(senderName)s set their display name to %(displayName)s.": "%(senderName)s установил отображаемое имя %(displayName)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": "Вышли", "Signed Out": "Вышли",
"Sorry, this homeserver is using a login which is not recognised ": "Извините, этот Home Server использует логин, который не удалось распознать ", "Sorry, this homeserver is using a login which is not recognised ": "Извините, этот Home Server использует логин, который не удалось распознать ",
"Tagged as: ": "Теги: ", "Tagged as: ": "Теги: ",

View file

@ -221,7 +221,6 @@
"decline": "avböj", "decline": "avböj",
"Decrypt %(text)s": "Dekryptera %(text)s", "Decrypt %(text)s": "Dekryptera %(text)s",
"Decryption error": "Dekrypteringsfel", "Decryption error": "Dekrypteringsfel",
"(default: %(userName)s)": "(standard: %(userName)s)",
"Delete": "Radera", "Delete": "Radera",
"demote": "degradera", "demote": "degradera",
"Deops user with given id": "Degraderar användaren med givet id", "Deops user with given id": "Degraderar användaren med givet id",

View file

@ -22,7 +22,6 @@
"Create Room": "สรัางห้อง", "Create Room": "สรัางห้อง",
"Delete": "ลบ", "Delete": "ลบ",
"Default": "ค่าเริ่มต้น", "Default": "ค่าเริ่มต้น",
"(default: %(userName)s)": "(ค่าเริ่มต้น: %(userName)s)",
"Default Device": "อุปกรณ์เริ่มต้น", "Default Device": "อุปกรณ์เริ่มต้น",
"%(senderName)s banned %(targetName)s.": "%(senderName)s แบน %(targetName)s แล้ว", "%(senderName)s banned %(targetName)s.": "%(senderName)s แบน %(targetName)s แล้ว",
"%(senderDisplayName)s changed the topic to \"%(topic)s\".": "%(senderDisplayName)s เปลี่ยนหัวข้อเป็น \"%(topic)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.": "เซิร์ฟเวอร์อาจไม่พร้อมใช้งาน ทำงานหนักเกินไป หรือบางอย่างผิดปกติ", "Server unavailable, overloaded, or something else went wrong.": "เซิร์ฟเวอร์อาจไม่พร้อมใช้งาน ทำงานหนักเกินไป หรือบางอย่างผิดปกติ",
"%(senderName)s set a profile picture.": "%(senderName)s ตั้งรูปโปรไฟล์", "%(senderName)s set a profile picture.": "%(senderName)s ตั้งรูปโปรไฟล์",
"%(senderName)s set their display name to %(displayName)s.": "%(senderName)s ตั้งชื่อที่แสดงเป็น %(displayName)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": "แสดงหน้าต่าง", "Show panel": "แสดงหน้าต่าง",
"Signed Out": "ออกจากระบบแล้ว", "Signed Out": "ออกจากระบบแล้ว",
"Sign in": "เข้าสู่ระบบ", "Sign in": "เข้าสู่ระบบ",