Create new application, half-done login form

master
Skylar Ittner 6 years ago
commit 168d6d9317

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,26 @@
<!DOCTYPE html>
<!--
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<title>Station</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="assets/img/logo_64.png">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<div id="content-frame" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;">
</div>
<script src="assets/js/jquery-3.2.1.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/fontawesome-all.min.js"></script>
<script src="js/functions.js"></script>
<script src="js/settings.js"></script>
<script src="js/session.js"></script>
<script>
openScreen("login");
</script>

@ -0,0 +1,16 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function openScreen(id) {
$('#content-frame').fadeOut('fast', function () {
$('#content-frame').load("pages/" + id + ".html", function () {
$('#content-frame').fadeIn('fast', function () {
});
});
});
}

@ -0,0 +1,66 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function userpasslogin(username, password) {
$.post(accounthubapi, {
key: apikey,
username: username,
password: password,
action: "auth"
}, function (resp) {
if (resp.status == "OK") {
$.post(accounthubapi, {
key: apikey,
username: username,
action: "userinfo"
}, function (resp) {
if (resp.status == "OK") {
setuser(resp.data.username);
setname(resp.data.name);
setuid(resp.data.uid);
openScreen("home");
} else {
alert(resp.msg);
}
}, "json");
} else {
alert(resp.msg);
}
}, "json");
}
function codelogin(code) {
$.post(accounthubapi, {
key: apikey,
code: code,
action: "codelogin"
}, function (resp) {
if (resp.status == "OK") {
setuser(resp.user.username);
setname(resp.user.realname);
setuid(resp.user.uid);
openScreen("home");
} else {
alert(resp.msg);
}
}, "json");
}
$("#userpassloginbtn").click(function () {
var user = $("#username").val();
var pass = $("#password").val();
if (user != "" && pass != "") {
userpasslogin(user, pass);
}
});
$("#mobilecodeloginbtn").click(function () {
var code = $("#code").val();
if (code != "") {
codelogin(code);
}
});

@ -0,0 +1,20 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var userdata = [];
function setuser(username) {
userdata["username"] = username;
}
function setname(realname) {
userdata["name"] = realname;
}
function setuid(uid) {
userdata["uid"] = uid;
}

@ -0,0 +1,9 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var accounthubapi = "http://localhost/accounthub/api.php";
var apikey = "123";

@ -0,0 +1,14 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
nw.Window.open('index.html', {
"id": "station_mainwindow"
}, function (win) {
win.setMinimumSize(780, 640);
win.setPosition("center");
});

@ -0,0 +1,9 @@
<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}This Source Code Form is subject to the terms of the Mozilla Public
${licensePrefix}License, v. 2.0. If a copy of the MPL was not distributed with this
${licensePrefix}file, You can obtain one at http://mozilla.org/MPL/2.0/.
<#if licenseLast??>
${licenseLast}
</#if>

@ -0,0 +1,6 @@
file.reference.BizApps-Station=.
file.reference.Station-public_html=public_html
file.reference.Station-test=test
files.encoding=UTF-8
project.licensePath=./nbproject/mplheader.txt
site.root.folder=${file.reference.BizApps-Station}

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>Station</name>
</data>
</configuration>
</project>

@ -0,0 +1,12 @@
{
"name": "netsyms-business-station",
"main": "main.js",
"version": "1.0.0",
"license": "MPL-2.0",
"author": "Skylar Ittner",
"contributors": [],
"dependencies": {},
"window": {
"icon": "assets/img/logo_64.png"
}
}

@ -0,0 +1,53 @@
<div class="container" style="height: 100%;">
<div class="row justify-content-center align-items-center" style="height: 100%;">
<div class="col-auto">
<div class="card" style="width: 100%;">
<h3 class="card-header"><i class="fas fa-lock"></i> Login</h3>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#userlist">Quick Access</a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#userpass">Username/Password</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#mobilecode">Mobile Code</a>
</li>
</ul>
<div class="card-body">
<div class="tab-content">
<div class="tab-pane fade active show" id="userpass">
<div id="userpass_form">
<div class="input-group">
<span class="input-group-addon"><i class="far fa-user"></i></span>
<input type="text" class="form-control" id="username" placeholder="Username" />
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fas fa-key"></i></span>
<input type="password" class="form-control" id="password" placeholder="Password" />
</div>
<br />
<button class="btn btn-primary" id="userpassloginbtn">Log In</button>
</div>
</div>
<div class="tab-pane fade" id="mobilecode">
<div class="alert alert-info">Open the Business app on your phone, <br />then press the <i class="fas fa-lock"></i> button to get a code.</div>
<div id="mobilecode_form">
<div class="input-group input-group-lg">
<span class="input-group-addon">B-</span>
<input type="text" class="form-control" id="code" placeholder="123456" />
</div>
<br />
<button class="btn btn-primary" id="mobilecodeloginbtn">Log In</button>
</div>
</div>
<div class="tab-pane fade" id="userlist">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="js/login.js"></script>
Loading…
Cancel
Save