Tell whether the server is a proxy

This commit is contained in:
Yuya Ochiai
2016-04-25 20:41:02 +09:00
parent a55eb6fa0f
commit 507889066a
2 changed files with 16 additions and 3 deletions

View File

@@ -20,14 +20,24 @@ const LoginModal = React.createClass({
passwordNode.value = '';
},
render: function() {
var serverType = '';
if (!this.props.show) {
serverType = '';
} else if (this.props.authInfo.isProxy) {
serverType = 'proxy';
} else {
serverType = 'server';
}
const message = `The ${serverType} ${this.props.authServerURL} requires a username and password.`;
return (
<Modal show={ this.props.show }>
<Modal.Header>
<Modal.Title>Authentication Required</Modal.Title>
</Modal.Header>
<Modal.Body>
<p>The server
{ ' ' + this.props.authServerURL } requires a username and password.</p>
<p>
{ message }
</p>
<Form horizontal onSubmit={ this.handleSubmit }>
<FormGroup>
<Col componentClass={ ControlLabel } sm={ 2 }>User&nbsp;Name</Col>

View File

@@ -194,14 +194,17 @@ var MainPage = React.createClass({
var request = null;
var authServerURL = null;
var authInfo = null;
if (this.state.loginQueue.length !== 0) {
request = this.state.loginQueue[0].request;
const tmp_url = url.parse(this.state.loginQueue[0].request.url);
authServerURL = `${tmp_url.protocol}//${tmp_url.host}`;
authInfo = this.state.loginQueue[0].authInfo;
}
return (
<div>
<LoginModal show={ this.state.loginQueue.length !== 0 } request={ request } authServerURL={ authServerURL } onLogin={ this.handleLogin } onCancel={ this.handleLoginCancel }></LoginModal>
<LoginModal show={ this.state.loginQueue.length !== 0 } request={ request } authInfo={ authInfo } authServerURL={ authServerURL } onLogin={ this.handleLogin }
onCancel={ this.handleLoginCancel }></LoginModal>
<Grid fluid>
{ tabs_row }
{ views_row }