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,
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}

View file

@ -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 = <Spinner />;
} else {
let guestUsername = this.props.username;
if (this.state.hsUrl != this.props.defaultHsUrl) {
guestUsername = null;
}
let errorSection;
if (this.state.errorText) {
errorSection = <div className="mx_Login_error">{this.state.errorText}</div>;
@ -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}

View file

@ -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 (
<div>
@ -354,9 +346,6 @@ module.exports = React.createClass({
className={this._classForField(FIELD_USERNAME, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_USERNAME);}} />
<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"
className={this._classForField(FIELD_PASSWORD, 'mx_Login_field')}
onBlur={function() {self.validateField(FIELD_PASSWORD);}}

View file

@ -849,7 +849,6 @@
"Anyone": "Jeder",
"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",
"(default: %(userName)s)": "(Standard: %(userName)s)",
"Device ID:": "Geräte-ID:",
"device id: ": "Geräte-ID: ",
"Device key:": "Geräte-Schlüssel:",
@ -859,7 +858,6 @@
"Password:": "Passwort:",
"Register": "Registrieren",
"Save": "Speichern",
"Setting a user name will create a fresh account": "Die Eingabe eines Benutzernamens wird ein neues Konto erzeugen",
"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.",
"There was a problem logging in.": "Es gab ein Problem beim anmelden.",

View file

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

View file

@ -236,7 +236,6 @@
"Decline": "Decline",
"Decrypt %(text)s": "Decrypt %(text)s",
"Decryption error": "Decryption error",
"(default: %(userName)s)": "(default: %(userName)s)",
"Delete": "Delete",
"demote": "demote",
"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 their display name to %(displayName)s.": "%(senderName)s set their display name to %(displayName)s.",
"Set": "Set",
"Setting a user name will create a fresh account": "Setting a user name will create a fresh account",
"Settings": "Settings",
"Show panel": "Show panel",
"Show Text Formatting Toolbar": "Show Text Formatting Toolbar",

View file

@ -224,7 +224,6 @@
"decline": "decline",
"Decrypt %(text)s": "Decrypt %(text)s",
"Decryption error": "Decryption error",
"(default: %(userName)s)": "(default: %(userName)s)",
"Delete": "Delete",
"demote": "demote",
"Deops user with given id": "Deops user with given id",
@ -464,7 +463,6 @@
"Session ID": "Session ID",
"%(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.",
"Setting a user name will create a fresh account": "Setting a user name will create a fresh account",
"Settings": "Settings",
"Show panel": "Show panel",
"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",
"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é",
"(default: %(userName)s)": "(défaut : %(userName)s)",
"Device ID:": "Identifiant de l'appareil :",
"device id: ": "Identifiant appareil : ",
"Device key:": "Clé de lappareil :",
@ -819,7 +818,6 @@
"Register": "S'inscrire",
"Remote addresses for this room:": "Supprimer l'adresse pour ce salon :",
"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 : ",
"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.",

View file

@ -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 <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.",

View file

@ -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 <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.",

View file

@ -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: ": "Теги: ",

View file

@ -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",

View file

@ -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": "เข้าสู่ระบบ",