3 * Copyright 2016 RIFT.IO Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 import React from 'react';
19 import Utils from 'utils/utils.js';
20 import Button from 'widgets/button/rw.button.js';
22 let rw = require('utils/rw.js');
23 class LoginScreen extends React.Component{
26 var API_SERVER = rw.getSearchParams(window.location).api_server;
28 window.location.href = "//" + window.location.host + '/index.html?api_server=' + window.location.protocol + '//localhost';
36 updateValue = (e) => {
38 state[e.target.name] = e.target.value;
43 let state = this.state;
45 if (state.username == '' || state.password == '') {
49 Utils.setAuthentication(state.username, state.password, function() {
50 //Returning to previous location disabled post port
51 // let hash = window.sessionStorage.getItem("locationRefHash") || '#/';
52 // if (hash == '#/login') {
55 // window.location.hash = hash;
56 self.context.router.push('/');
69 <form className="login-cntnr" autoComplete="on" onKeyUp={this.submitForm}>
70 <div className="logo"> </div>
71 <h1 className="riftio">Launchpad Login</h1>
73 <input type="text" placeholder="Username" name="username" value={this.state.username} onChange={this.updateValue} autoComplete="username"></input>
76 <input type="password" placeholder="Password" name="password" onChange={this.updateValue} value={this.state.password} autoComplete="password"></input>
79 <Button className="sign-in" onClick={this.validate} style={{cursor: 'pointer'}} type="submit" label="Sign In"/>
86 LoginScreen.contextTypes = {
87 router: React.PropTypes.object
91 export default LoginScreen;