Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "ext/CvLoginPanel"

Index

Variables

CvLoginPanel

CvLoginPanel: ClassicComponentClass<CvLoginPanelProps> = React.createClass<CvLoginPanelProps, CvLoginPanelState>({mixins: [CvBaseMixin],getChildContext: function () {return this.getDefaultChildContext();},getDefaultProps: function () {return {loginListeners: [],actionListeners: [],defaultClientType: 'RICH_CLIENT',defaultDirectUrl: '',defaultGatewayUrl: 'www.catavolt.net',defaultPassword: '',defaultTenantId: '',defaultUserId: '',showClientType: true,showDirectUrl: true,showGatewayUrl: true,showTenantId: true}},getInitialState: function () {return {directUrl: this.props.defaultDirectUrl,tenantId: this.props.defaultTenantId,gatewayUrl: this.props.defaultGatewayUrl,userId: this.props.defaultUserId,password: this.props.defaultPassword,clientType: this.props.defaultClientType,error:null,showWait: false}},render: function () {return (<CvLogin loginListeners={this.props.loginListeners} actionListeners={this.props.actionListeners}renderer={(cvContext:CvContext, callback:CvLoginCallback)=>{if(!callback.isLoggedIn()) {return (<div className="well cv-login-form-container animated fadeInUp"><form className="form-horizontal cv-login-form" onSubmit={this.handleSubmit.bind(this, callback)}>{(()=>{ if(this.props.showDirectUrl) {return (<div className="form-group"><label htmlFor="directUrl" className="col-sm-2 control-label">Direct URL:</label><div className="col-sm-10"><input id="directUrl" type="text" className="form-control"value={this.state.directUrl}disabled={!!this.state.gatewayUrl}onChange={this.handleChange.bind(this, 'directUrl')}/></div></div>)}})()}{(()=>{ if(this.props.showGatewayUrl) {return (<div className="form-group"><label htmlFor="gatewayUrl" className="col-sm-2 control-label">Gateway URL:</label><div className="col-sm-10"><div className="input-group"><input id="gatewayUrl" type="text" className="form-control"value={this.state.gatewayUrl}onChange={this.handleChange.bind(this, 'gatewayUrl')}disabled={!!this.state.directUrl}aria-describedby="http-addon"/></div></div></div>)}})()}{(()=>{ if(this.props.showTenantId) {return (<div className="form-group"><label htmlFor="tenantId" className="col-sm-2 control-label">Tenant Id:</label><div className="col-sm-10"><input id="tenantId" type="text" className="form-control"value={this.state.tenantId}onChange={this.handleChange.bind(this, 'tenantId')}required/></div></div>)}})()}<div className="form-group"><label htmlFor="userId" className="col-sm-2 control-label">User Id:</label><div className="col-sm-10"><input id="userId" type="text" className="form-control"value={this.state.userId}onChange={this.handleChange.bind(this, 'userId')}required/></div></div><div className="form-group"><label htmlFor="password" className="col-sm-2 control-label">Password:</label><div className="col-sm-10"><input id="password" type="password" className="form-control"value={this.state.password}onChange={this.handleChange.bind(this, 'password')}required/></div></div>{(()=>{ if(this.props.showClientType) {return (<div className="form-group"><label htmlFor="clientType" className="col-sm-2 control-label">Client Type:</label><div className="col-sm-10"><label className="radio-inline"><input id="clientType" type="radio"onChange={this.handleRadioChange.bind(this, 'clientType', 'LIMITED_ACCESS')}checked={this.state.clientType === 'LIMITED_ACCESS'}/>Limited</label><label className="radio-inline"><input id="clientType" type="radio"onChange={this.handleRadioChange.bind(this, 'clientType', 'RICH_CLIENT')}checked={this.state.clientType === 'RICH_CLIENT'}/>Rich</label></div></div>)}})()}<div className="form-group"><div className="col-sm-10 col-sm-offset-2"><button type="submit" className="btn btn-default btn-primary btn-block"value="Login">Login <span className="glyphicon glyphicon-log-in" aria-hidden="true"/></button></div></div><div><div className="cv-login-error">{this.state.error ?<div><span className="glyphicon glyphicon-warning-sign" aria-hidden="true"/><span style={{marginLeft:'10px'}}>Invalid Login</span></div> : null}</div></div></form></div>);} else {return null;}}}/>);},handleChange: function (field:string, e:any) {var nextState = {};nextState[field] = e.target.value;this.setState(nextState);},handleRadioChange: function (field, value, e:any) {var nextState = {};nextState[field] = value;this.setState(nextState);},handleSubmit: function (callback:CvLoginCallback, e:any) {e.preventDefault();this.setState({error:null, showWait:true});const resultCallback:CvResultCallback<CvLoginResult> = (success:CvLoginResult, error:any)=>{this.setState({showWait:false});if(error) { this.setState({error: error}); }};if(this.state.directUrl) {callback.loginDirectly(this.state.directUrl, this.state.tenantId, this.state.clientType,this.state.userId, this.state.password, resultCallback);} else {callback.login(this.state.gatewayUrl, this.state.tenantId, this.state.clientType,this.state.userId, this.state.password, resultCallback);}},})

Generated using TypeDoc