2016-10-11 20:04:55 +03:00
|
|
|
/*
|
|
|
|
Copyright 2016 OpenMarket Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Matrix from 'matrix-js-sdk';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import sdk from '../../../index';
|
|
|
|
|
2017-02-13 19:03:21 +03:00
|
|
|
import AccessibleButton from '../elements/AccessibleButton';
|
2016-10-11 20:04:55 +03:00
|
|
|
|
|
|
|
export default React.createClass({
|
|
|
|
displayName: 'InteractiveAuthDialog',
|
|
|
|
|
|
|
|
propTypes: {
|
|
|
|
// response from initial request. If not supplied, will do a request on
|
|
|
|
// mount.
|
|
|
|
authData: React.PropTypes.shape({
|
|
|
|
flows: React.PropTypes.array,
|
|
|
|
params: React.PropTypes.object,
|
|
|
|
session: React.PropTypes.string,
|
|
|
|
}),
|
|
|
|
|
|
|
|
// callback
|
|
|
|
makeRequest: React.PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
onFinished: React.PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
title: React.PropTypes.string,
|
|
|
|
},
|
|
|
|
|
|
|
|
getDefaultProps: function() {
|
|
|
|
return {
|
|
|
|
title: "Authentication",
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2017-02-13 19:03:21 +03:00
|
|
|
_onCancelClick: function() {
|
2016-10-11 20:04:55 +03:00
|
|
|
this.props.onFinished(false);
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
2017-02-13 19:03:21 +03:00
|
|
|
const InteractiveAuth = sdk.getComponent("structures.InteractiveAuth");
|
2017-01-24 18:54:05 +03:00
|
|
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
2016-10-11 20:04:55 +03:00
|
|
|
|
|
|
|
return (
|
2017-01-24 18:54:05 +03:00
|
|
|
<BaseDialog className="mx_InteractiveAuthDialog"
|
|
|
|
onFinished={this.props.onFinished}
|
|
|
|
title={this.props.title}
|
|
|
|
>
|
2017-02-13 19:03:21 +03:00
|
|
|
<div>
|
|
|
|
<InteractiveAuth ref={this._collectInteractiveAuth}
|
|
|
|
authData={this.props.authData}
|
|
|
|
makeRequest={this.props.makeRequest}
|
|
|
|
onFinished={this.props.onFinished}
|
|
|
|
/>
|
2016-10-11 20:04:55 +03:00
|
|
|
</div>
|
2017-01-24 18:54:05 +03:00
|
|
|
</BaseDialog>
|
2016-10-11 20:04:55 +03:00
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|