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 import rw from 'utils/rw.js';
24 class LoginScreen extends React.Component{
27 var API_SERVER = rw.getSearchParams(window.location).api_server;
29 window.location.href = "//" + window.location.host + '/index.html?api_server=' + window.location.protocol + '//localhost';
37 updateValue = (e) => {
39 state[e.target.name] = e.target.value;
44 let state = this.state;
46 if (state.username == '' || state.password == '') {
50 Utils.setAuthentication(state.username, state.password, function() {
51 //Returning to previous location disabled post port
52 // let hash = window.sessionStorage.getItem("locationRefHash") || '#/';
53 // if (hash == '#/login') {
56 // window.location.hash = hash;
57 self.context.router.push('/');
70 <form className="login-cntnr" autoComplete="on" onKeyUp={this.submitForm}>
71 <div className="logo"> </div>
72 <h1 className="riftio">Launchpad Login</h1>
74 <input type="text" placeholder="Username" name="username" value={this.state.username} onChange={this.updateValue} autoComplete="username"></input>
77 <input type="password" placeholder="Password" name="password" onChange={this.updateValue} value={this.state.password} autoComplete="password"></input>
80 <Button className="sign-in" onClick={this.validate} style={{cursor: 'pointer'}} type="submit" label="Sign In"/>
87 LoginScreen.contextTypes = {
88 router: React.PropTypes.object
92 export default LoginScreen;