Address review request comments

pull/21833/head
Peter Vágner 2017-12-14 10:31:28 +01:00
parent ab0ff9b781
commit 642675c96d
3 changed files with 43 additions and 15 deletions

View File

@ -73,7 +73,7 @@ export default React.createClass({
if (this.state.authError) { if (this.state.authError) {
content = ( content = (
<div id='mx_Dialog_content'> <div id='mx_Dialog_content'>
<div role={(this.state.authError.message || this.state.authError.toString()) ? "alert" : ""}>{ this.state.authError.message || this.state.authError.toString() }</div> <div role="alert">{ this.state.authError.message || this.state.authError.toString() }</div>
<br /> <br />
<AccessibleButton onClick={this._onDismissClick} <AccessibleButton onClick={this._onDismissClick}
className="mx_UserSettings_button" className="mx_UserSettings_button"

View File

@ -60,6 +60,7 @@ export default React.createClass({
</p> </p>
); );
} }
const shouldFocusContinueButton =!(bugreport==true);
return ( return (
<BaseDialog className="mx_ErrorDialog" onFinished={this.props.onFinished} <BaseDialog className="mx_ErrorDialog" onFinished={this.props.onFinished}
@ -77,8 +78,8 @@ export default React.createClass({
{ bugreport } { bugreport }
</div> </div>
<div className="mx_Dialog_buttons" autoFocus={SdkConfig.get().bug_report_endpoint_url ? false : true}> <div className="mx_Dialog_buttons">
<button className="mx_Dialog_primary" onClick={this._continueClicked}> <button className="mx_Dialog_primary" onClick={this._continueClicked} autoFocus={shouldFocusContinueButton}>
{ _t("Continue anyway") } { _t("Continue anyway") }
</button> </button>
</div> </div>

View File

@ -127,6 +127,15 @@ export const PasswordAuthEntry = React.createClass({
); );
} }
let errorSection;
if (this.props.errorText) {
errorSection = (
<div className="error" role="alert">
{ this.props.errorText }
</div>
);
}
return ( return (
<div> <div>
<p>{ _t("To continue, please enter your password.") }</p> <p>{ _t("To continue, please enter your password.") }</p>
@ -143,9 +152,7 @@ export const PasswordAuthEntry = React.createClass({
{ submitButtonOrSpinner } { submitButtonOrSpinner }
</div> </div>
</form> </form>
<div className="error" role={ this.props.errorText ? "alert" : ""}> { errorSection }
{ this.props.errorText }
</div>
</div> </div>
); );
}, },
@ -180,14 +187,22 @@ export const RecaptchaAuthEntry = React.createClass({
const CaptchaForm = sdk.getComponent("views.login.CaptchaForm"); const CaptchaForm = sdk.getComponent("views.login.CaptchaForm");
const sitePublicKey = this.props.stageParams.public_key; const sitePublicKey = this.props.stageParams.public_key;
let errorSection;
if (this.props.errorText) {
errorSection = (
<div className="error" role="alert">
{ this.props.errorText }
</div>
);
}
return ( return (
<div> <div>
<CaptchaForm sitePublicKey={sitePublicKey} <CaptchaForm sitePublicKey={sitePublicKey}
onCaptchaResponse={this._onCaptchaResponse} onCaptchaResponse={this._onCaptchaResponse}
/> />
<div className="error" role={ this.props.errorText ? "alert" : ""}> { errorSection }
{ this.props.errorText }
</div>
</div> </div>
); );
}, },
@ -372,6 +387,14 @@ export const MsisdnAuthEntry = React.createClass({
mx_InteractiveAuthEntryComponents_msisdnSubmit: true, mx_InteractiveAuthEntryComponents_msisdnSubmit: true,
mx_UserSettings_button: true, // XXX button classes mx_UserSettings_button: true, // XXX button classes
}); });
let errorSection;
if (this.state.errorText) {
errorSection = (
<div className="error" role="alert">
{ this.state.errorText }
</div>
);
}
return ( return (
<div> <div>
<p>{ _t("A text message has been sent to %(msisdn)s", <p>{ _t("A text message has been sent to %(msisdn)s",
@ -393,9 +416,7 @@ export const MsisdnAuthEntry = React.createClass({
disabled={!enableSubmit} disabled={!enableSubmit}
/> />
</form> </form>
<div className="error" role={this.state.errorText ? "alert" : ""}> {errorSection}
{ this.state.errorText }
</div>
</div> </div>
</div> </div>
); );
@ -452,12 +473,18 @@ export const FallbackAuthEntry = React.createClass({
}, },
render: function() { render: function() {
let errorSection;
if (this.props.errorText) {
errorSection = (
<div className="error" role="alert">
{ this.props.errorText }
</div>
);
}
return ( return (
<div> <div>
<a ref="fallbackButton" onClick={this._onShowFallbackClick}>{ _t("Start authentication") }</a> <a ref="fallbackButton" onClick={this._onShowFallbackClick}>{ _t("Start authentication") }</a>
<div className="error" role={ this.props.errorText ? "alert" : ""}> {errorSection}
{ this.props.errorText }
</div>
</div> </div>
); );
}, },