Merge pull request #1456 from matrix-org/dbkr/say_which_homeserver

Make it clearer which HS you're logging into
This commit is contained in:
Luke Barnard 2017-10-11 15:11:22 +02:00 committed by GitHub
commit f6eca14bee
26 changed files with 61 additions and 32 deletions

View file

@ -290,6 +290,7 @@ module.exports = React.createClass({
onPhoneNumberChanged={this.onPhoneNumberChanged}
onForgotPasswordClick={this.props.onForgotPasswordClick}
loginIncorrect={this.state.loginIncorrect}
hsUrl={this.state.enteredHomeserverUrl}
/>
);
case 'm.login.cas':

View file

@ -26,6 +26,12 @@ class MenuOption extends React.Component {
this._onClick = this._onClick.bind(this);
}
getDefaultProps() {
return {
disabled: false,
}
}
_onMouseEnter() {
this.props.onMouseEnter(this.props.dropdownKey);
}
@ -153,6 +159,8 @@ export default class Dropdown extends React.Component {
}
_onInputClick(ev) {
if (this.props.disabled) return;
if (!this.state.expanded) {
this.setState({
expanded: true,
@ -294,6 +302,7 @@ export default class Dropdown extends React.Component {
const dropdownClasses = {
mx_Dropdown: true,
mx_Dropdown_disabled: this.props.disabled,
};
if (this.props.className) {
dropdownClasses[this.props.className] = true;
@ -329,4 +338,6 @@ Dropdown.propTypes = {
// in the dropped-down menu.
getShortOption: React.PropTypes.func,
value: React.PropTypes.string,
// negative for consistency with HTML
disabled: React.PropTypes.bool,
}

View file

@ -123,7 +123,7 @@ export default class CountryDropdown extends React.Component {
return <Dropdown className={this.props.className + " left_aligned"}
onOptionChange={this._onOptionChange} onSearchChange={this._onSearchChange}
menuWidth={298} getShortOption={this._getShortOption}
value={value} searchEnabled={true}
value={value} searchEnabled={true} disabled={this.props.disabled}
>
{options}
</Dropdown>;
@ -137,4 +137,5 @@ CountryDropdown.propTypes = {
showPrefix: React.PropTypes.bool,
onOptionChange: React.PropTypes.func.isRequired,
value: React.PropTypes.string,
disabled: React.PropTypes.bool,
};

View file

@ -116,11 +116,17 @@ class PasswordLogin extends React.Component {
this.props.onPasswordChanged(ev.target.value);
}
renderLoginField(loginType) {
renderLoginField(loginType, disabled) {
const classes = {
mx_Login_field: true,
mx_Login_field_disabled: disabled,
};
switch(loginType) {
case PasswordLogin.LOGIN_FIELD_EMAIL:
classes.mx_Login_email = true;
return <input
className="mx_Login_field mx_Login_email"
className={classNames(classes)}
key="email_input"
type="text"
name="username" // make it a little easier for browser's remember-password
@ -128,10 +134,12 @@ class PasswordLogin extends React.Component {
placeholder="joe@example.com"
value={this.state.username}
autoFocus
disabled={disabled}
/>;
case PasswordLogin.LOGIN_FIELD_MXID:
classes.mx_Login_username = true;
return <input
className="mx_Login_field mx_Login_username"
className={classNames(classes)}
key="username_input"
type="text"
name="username" // make it a little easier for browser's remember-password
@ -139,9 +147,12 @@ class PasswordLogin extends React.Component {
placeholder={_t('User name')}
value={this.state.username}
autoFocus
disabled={disabled}
/>;
case PasswordLogin.LOGIN_FIELD_PHONE:
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
classes.mx_Login_phoneNumberField = true;
classes.mx_Login_field_has_prefix = true;
return <div className="mx_Login_phoneSection">
<CountryDropdown
className="mx_Login_phoneCountry mx_Login_field_prefix"
@ -150,9 +161,10 @@ class PasswordLogin extends React.Component {
value={this.state.phoneCountry}
isSmall={true}
showPrefix={true}
disabled={disabled}
/>
<input
className="mx_Login_phoneNumberField mx_Login_field mx_Login_field_has_prefix"
className={classNames(classes)}
ref="phoneNumber"
key="phone_input"
type="text"
@ -161,6 +173,7 @@ class PasswordLogin extends React.Component {
placeholder={_t("Mobile phone number")}
value={this.state.phoneNumber}
autoFocus
disabled={disabled}
/>
</div>;
}
@ -177,14 +190,25 @@ class PasswordLogin extends React.Component {
);
}
let matrixIdText = '';
if (this.props.hsUrl) {
try {
const parsedHsUrl = new URL(this.props.hsUrl);
matrixIdText = _t('%(serverName)s Matrix ID', {serverName: parsedHsUrl.hostname});
} catch (e) {
// pass
}
}
const pwFieldClass = classNames({
mx_Login_field: true,
mx_Login_field_disabled: matrixIdText === '',
error: this.props.loginIncorrect,
});
const Dropdown = sdk.getComponent('elements.Dropdown');
const loginField = this.renderLoginField(this.state.loginType);
const loginField = this.renderLoginField(this.state.loginType, matrixIdText === '');
return (
<div>
@ -194,8 +218,9 @@ class PasswordLogin extends React.Component {
<Dropdown
className="mx_Login_type_dropdown"
value={this.state.loginType}
disabled={matrixIdText === ''}
onOptionChange={this.onLoginTypeChange}>
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{ _t('my Matrix ID') }</span>
<span key={PasswordLogin.LOGIN_FIELD_MXID}>{matrixIdText}</span>
<span key={PasswordLogin.LOGIN_FIELD_EMAIL}>{ _t('Email address') }</span>
<span key={PasswordLogin.LOGIN_FIELD_PHONE}>{ _t('Phone') }</span>
</Dropdown>
@ -204,10 +229,12 @@ class PasswordLogin extends React.Component {
<input className={pwFieldClass} ref={(e) => {this._passwordField = e;}} type="password"
name="password"
value={this.state.password} onChange={this.onPasswordChanged}
placeholder={ _t('Password') } />
placeholder={ _t('Password') }
disabled={matrixIdText === ''}
/>
<br />
{forgotPasswordJsx}
<input className="mx_Login_submit" type="submit" value={ _t('Sign in') } />
<input className="mx_Login_submit" type="submit" value={ _t('Sign in') } disabled={matrixIdText === ''} />
</form>
</div>
);

View file

@ -146,7 +146,7 @@
"Members only": "Nur Mitglieder",
"Mobile phone number": "Mobiltelefonnummer",
"Moderator": "Moderator",
"my Matrix ID": "meiner Matrix-ID",
"%(serverName)s Matrix ID": "%(serverName)s Matrix-ID",
"Never send encrypted messages to unverified devices from this device": "Niemals verschlüsselte Nachrichten an unverifizierte Geräte von diesem Gerät aus versenden",
"Never send encrypted messages to unverified devices in this room from this device": "Niemals verschlüsselte Nachrichten an unverifizierte Geräte in diesem Raum von diesem Gerät aus senden",
"New password": "Neues Passwort",

View file

@ -188,7 +188,6 @@
"Failure to create room": "Δεν ήταν δυνατή η δημιουργία δωματίου",
"Join Room": "Είσοδος σε δωμάτιο",
"Moderator": "Συντονιστής",
"my Matrix ID": "το Matrix ID μου",
"Name": "Όνομα",
"New address (e.g. #foo:%(localDomain)s)": "Νέα διεύθυνση (e.g. #όνομα:%(localDomain)s)",
"New password": "Νέος κωδικός πρόσβασης",

View file

@ -295,7 +295,6 @@
"Moderator": "Moderator",
"Must be viewing a room": "Must be viewing a room",
"Mute": "Mute",
"my Matrix ID": "my Matrix ID",
"Name": "Name",
"Never send encrypted messages to unverified devices from this device": "Never send encrypted messages to unverified devices from this device",
"Never send encrypted messages to unverified devices in this room": "Never send encrypted messages to unverified devices in this room",
@ -906,5 +905,6 @@
"Related Groups": "Related Groups",
"Related groups for this room:": "Related groups for this room:",
"This room has no related groups": "This room has no related groups",
"New group ID (e.g. +foo:%(localDomain)s)": "New group ID (e.g. +foo:%(localDomain)s)"
"New group ID (e.g. +foo:%(localDomain)s)": "New group ID (e.g. +foo:%(localDomain)s)",
"%(serverName)s Matrix ID": "%(serverName)s Matrix ID"
}

View file

@ -262,7 +262,6 @@
"Moderator": "Moderator",
"Must be viewing a room": "Must be viewing a room",
"Mute": "Mute",
"my Matrix ID": "my Matrix ID",
"Name": "Name",
"Never send encrypted messages to unverified devices from this device": "Never send encrypted messages to unverified devices from this device",
"Never send encrypted messages to unverified devices in this room": "Never send encrypted messages to unverified devices in this room",

View file

@ -379,7 +379,7 @@
"Moderator": "Moderador",
"Must be viewing a room": "Debe estar viendo una sala",
"Mute": "Silenciar",
"my Matrix ID": "Mi ID de Matrix",
"%(serverName)s Matrix ID": "%(serverName)s ID de Matrix",
"Name": "Nombre",
"Never send encrypted messages to unverified devices from this device": "No enviar nunca mensajes cifrados, desde este dispositivo, a dispositivos sin verificar",
"Never send encrypted messages to unverified devices in this room": "No enviar nunca mensajes cifrados a dispositivos no verificados, en esta sala",

View file

@ -346,7 +346,6 @@
"Missing room_id in request": "Gelaren ID-a falta da eskaeran",
"Missing user_id in request": "Erabiltzailearen ID-a falta da eskaeran",
"Mobile phone number": "Mugikorraren telefono zenbakia",
"my Matrix ID": "Nire Matrix ID-a",
"Never send encrypted messages to unverified devices in this room": "Ez bidali inoiz zifratutako mezuak egiaztatu gabeko gailuetara gela honetan",
"Never send encrypted messages to unverified devices in this room from this device": "Ez bidali inoiz zifratutako mezuak egiaztatu gabeko gailuetara gela honetan gailu honetatik",
"New address (e.g. #foo:%(localDomain)s)": "Helbide berria (adib. #foo:%(localDomain)s)",

View file

@ -245,7 +245,7 @@
"Mobile phone number": "Matkapuhelinnumero",
"Mobile phone number (optional)": "Matkapuhelinnumero (valinnainen)",
"Moderator": "Moderaattori",
"my Matrix ID": "minun Matrix tunniste",
"%(serverName)s Matrix ID": "%(serverName)s Matrix tunniste",
"Name": "Nimi",
"New password": "Uusi salasana",
"New passwords don't match": "Uudet salasanat eivät täsmää",

View file

@ -224,7 +224,7 @@
"Mobile phone number": "Numéro de téléphone mobile",
"Moderator": "Modérateur",
"Must be viewing a room": "Doit être en train de visualiser un salon",
"my Matrix ID": "mon identifiant Matrix",
"%(serverName)s Matrix ID": "%(serverName)s identifiant Matrix",
"Name": "Nom",
"Never send encrypted messages to unverified devices from this device": "Ne jamais envoyer de message chiffré aux appareils non-vérifiés depuis cet appareil",
"Never send encrypted messages to unverified devices in this room": "Ne jamais envoyer de message chiffré aux appareils non-vérifiés dans ce salon",

View file

@ -293,7 +293,7 @@
"Mobile phone number (optional)": "Mobill telefonszám (opcionális)",
"Moderator": "Moderátor",
"Must be viewing a room": "Meg kell nézni a szobát",
"my Matrix ID": "Matrix azonosítóm",
"%(serverName)s Matrix ID": "%(serverName)s Matrix azonosítóm",
"Name": "Név",
"Never send encrypted messages to unverified devices from this device": "Soha ne küldj titkosított üzenetet ellenőrizetlen eszközre erről az eszközről",
"Never send encrypted messages to unverified devices in this room": "Soha ne küldj titkosított üzenetet ebből a szobából ellenőrizetlen eszközre",

View file

@ -78,7 +78,6 @@
"Members only": "Hanya anggota",
"Mobile phone number": "Nomor telpon seluler",
"Mute": "Bisu",
"my Matrix ID": "ID Matrix saya",
"Name": "Nama",
"New password": "Password Baru",
"New passwords don't match": "Password baru tidak cocok",

View file

@ -293,7 +293,6 @@
"Mobile phone number (optional)": "휴대 전화번호 (선택)",
"Moderator": "조정자",
"Must be viewing a room": "방을 둘러봐야만 해요",
"my Matrix ID": "내 매트릭스 ID",
"Name": "이름",
"Never send encrypted messages to unverified devices from this device": "이 장치에서 인증받지 않은 장치로 암호화한 메시지를 보내지 마세요",
"Never send encrypted messages to unverified devices in this room": "이 방에서 인증받지 않은 장치로 암호화한 메시지를 보내지 마세요",

View file

@ -274,7 +274,7 @@
"Moderator": "Moderators",
"Must be viewing a room": "Jāapskata istaba",
"Mute": "Apklusināt",
"my Matrix ID": "mans Matrix ID",
"%(serverName)s Matrix ID": "%(serverName)s Matrix ID",
"Name": "Vārds",
"Never send encrypted messages to unverified devices from this device": "Nekad nesūti no šīs ierīces šifrētas ziņas uz neverificētām ierīcēm",
"Never send encrypted messages to unverified devices in this room": "Nekad nesūti šifrētas ziņas uz neverificētām ierīcēm šajā istabā",

View file

@ -126,7 +126,7 @@
"disabled": "uitgeschakeld",
"Moderator": "Moderator",
"Must be viewing a room": "Moet een ruimte weergeven",
"my Matrix ID": "mijn Matrix-ID",
"%(serverName)s Matrix ID": "%(serverName)s Matrix-ID",
"Name": "Naam",
"New password": "Nieuw wachtwoord",
"none": "geen",

View file

@ -363,7 +363,7 @@
"Mobile phone number": "Numer telefonu komórkowego",
"Mobile phone number (optional)": "Numer telefonu komórkowego (opcjonalne)",
"Moderator": "Moderator",
"my Matrix ID": "mój Matrix ID",
"%(serverName)s Matrix ID": "%(serverName)s Matrix ID",
"Name": "Imię",
"Never send encrypted messages to unverified devices from this device": "Nigdy nie wysyłaj zaszyfrowanych wiadomości do niezweryfikowanych urządzeń z tego urządzenia",
"Never send encrypted messages to unverified devices in this room": "Nigdy nie wysyłaj zaszyfrowanych wiadomości do niezweryfikowanych urządzeń w tym pokoju",

View file

@ -127,7 +127,6 @@
"Members only": "Apenas integrantes da sala",
"Mobile phone number": "Telefone celular",
"Moderator": "Moderador/a",
"my Matrix ID": "com meu ID do Matrix",
"Name": "Nome",
"Never send encrypted messages to unverified devices from this device": "Nunca envie mensagens criptografada para um dispositivo não verificado a partir deste dispositivo",
"Never send encrypted messages to unverified devices in this room from this device": "Nunca envie mensagens criptografadas para dispositivos não verificados nesta sala a partir deste dispositivo",

View file

@ -127,7 +127,6 @@
"Members only": "Apenas integrantes da sala",
"Mobile phone number": "Telefone celular",
"Moderator": "Moderador/a",
"my Matrix ID": "com meu ID do Matrix",
"Name": "Nome",
"Never send encrypted messages to unverified devices from this device": "Nunca envie mensagens criptografada para um dispositivo não verificado a partir deste dispositivo",
"Never send encrypted messages to unverified devices in this room from this device": "Nunca envie mensagens criptografadas para dispositivos não verificados nesta sala a partir deste dispositivo",

View file

@ -117,7 +117,7 @@
"Members only": "Только участники",
"Mobile phone number": "Номер мобильного телефона",
"Moderator": "Модератор",
"my Matrix ID": "мой Matrix ID",
"%(serverName)s Matrix ID": "%(serverName)s Matrix ID",
"Name": "Имя",
"Never send encrypted messages to unverified devices from this device": "Никогда не отправлять зашифрованные сообщения на непроверенные устройства с этого устройства",
"Never send encrypted messages to unverified devices in this room from this device": "Никогда не отправлять зашифрованные сообщения на непроверенные устройства в этой комнате с этого устройства",

View file

@ -273,7 +273,7 @@
"Moderator": "Moderator",
"Must be viewing a room": "Du måste ha ett öppet rum",
"Mute": "Dämpa",
"my Matrix ID": "mitt Matrix-ID",
"%(serverName)s Matrix ID": "%(serverName)s Matrix-ID",
"Name": "Namn",
"Never send encrypted messages to unverified devices from this device": "Skicka aldrig krypterade meddelanden till overifierade enheter från den här enheten",
"Never send encrypted messages to unverified devices in this room": "Skicka aldrig krypterade meddelanden till overifierade enheter i det här rummet",

View file

@ -219,7 +219,6 @@
"Markdown is enabled": "เปิดใช้งาน Markdown แล้ว",
"Missing user_id in request": "ไม่พบ user_id ในคำขอ",
"Moderator": "ผู้ช่วยดูแล",
"my Matrix ID": "Matrix ID ของฉัน",
"New address (e.g. #foo:%(localDomain)s)": "ที่อยู่ใหม่ (เช่น #foo:%(localDomain)s)",
"New password": "รหัสผ่านใหม่",
"New passwords don't match": "รหัสผ่านใหม่ไม่ตรงกัน",

View file

@ -269,7 +269,6 @@
"Moderator": "Moderatör",
"Must be viewing a room": "Bir oda görüntülemeli olmalı",
"Mute": "Sessiz",
"my Matrix ID": "Benim Matrix ID'm",
"Name": "İsim",
"Never send encrypted messages to unverified devices from this device": "Bu cihazdan doğrulanmamış cihazlara asla şifrelenmiş mesajlar göndermeyin",
"Never send encrypted messages to unverified devices in this room": "Bu odada doğrulanmamış cihazlara asla şifreli mesajlar göndermeyin",

View file

@ -289,7 +289,6 @@
"Mobile phone number (optional)": "手机号码 (可选)",
"Moderator": "管理员",
"Mute": "静音",
"my Matrix ID": "我的 Matrix ID",
"Name": "姓名",
"Never send encrypted messages to unverified devices from this device": "不要从此设备向未验证的设备发送消息",
"Never send encrypted messages to unverified devices in this room": "不要在此聊天室里向未验证的设备发送消息",

View file

@ -403,7 +403,6 @@
"Mobile phone number (optional)": "行動電話號碼(選擇性)",
"Moderator": "仲裁者",
"Must be viewing a room": "必須檢視房間",
"my Matrix ID": "我的 Matrix ID",
"Name": "名稱",
"Never send encrypted messages to unverified devices from this device": "從不自此裝置傳送加密的訊息到未驗證的裝置",
"Never send encrypted messages to unverified devices in this room": "從不在此房間傳送加密的訊息到未驗證的裝置",