Adding connection on navbar
This commit is contained in:
parent
4b6b6680fe
commit
ebe635acd9
4
.gitignore
vendored
4
.gitignore
vendored
@ -14,3 +14,7 @@ META-INF/
|
|||||||
|
|
||||||
|
|
||||||
classes/artifacts/Discord_Stroumpf_Beta_jar/
|
classes/artifacts/Discord_Stroumpf_Beta_jar/
|
||||||
|
|
||||||
|
src/main/resources/templates/css
|
||||||
|
|
||||||
|
src/main/resources/templates/js
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
.nav-wrapper{
|
/*.nav-wrapper{*/
|
||||||
margin-right: 1%;
|
/*!*margin-right: 1%;*!*/
|
||||||
margin-left: 1%;
|
/*margin-left: 1%;*/
|
||||||
width: 100%;
|
/*width: 100%;*/
|
||||||
}
|
/*}*/
|
||||||
|
|
||||||
|
|
||||||
.collapsible-body{
|
.collapsible-body{
|
||||||
|
@ -15,32 +15,109 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="blue-grey lighten-5" >
|
<body class="blue-grey lighten-5" >
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
<!-- NAV BAR -->
|
||||||
|
<!-- AND -->
|
||||||
|
<!-- LOGIN -->
|
||||||
|
<!--__________________________________________________________-->
|
||||||
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
|
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
|
||||||
<div class="nav-wrapper container">
|
<div class="nav-wrapper container">
|
||||||
<a id="logo-container" href="#" class="brand-logo">Discord Bot</a>
|
<a id="logo-container" href="#" class="brand-logo">Discord Bot</a>
|
||||||
<ul class="right hide-on-med-and-down">
|
<ul class="right hide-on-med-and-down">
|
||||||
|
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="/" data-target="slide-out" class="sidenav-trigger">Home</a>
|
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/music" >Music Control</a>
|
<a class="waves-effect waves-light" href="/music" >Music Control</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li id="nav-bar-account">
|
||||||
|
<a class="dropdown-account" data-activates="dropdown1"><i class="material-icons">account_box</i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="side-nav">
|
<ul id="nav-mobile" class="side-nav">
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="/" data-target="slide-out" class="sidenav-trigger">Home</a>
|
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/music" data-target="slide-out" class="sidenav-trigger">Music Control</a>
|
<a class="waves-effect waves-light sidenav-trigger" href="/music" data-target="slide-out" >Music Control</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a href="#" data-activates="nav-mobile" class="button-collapse-1 button-collapse"><i class="material-icons">menu</i></a>
|
<a href="#" data-activates="nav-mobile" class="button-navbar-mobile button-collapse"><i class="material-icons">menu</i></a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<!-- Dropdown connected -->
|
||||||
|
<ul id="dropdown_connected" class="dropdown-content ">
|
||||||
|
<li>
|
||||||
|
<a class="center blue-grey-text text-darken-4" id="nav-name" style="text-decoration: underline; font-weight: bold"></a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li>
|
||||||
|
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Account</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Playlists</a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a class="center red-text" id="nav-disconnect" style="font-weight: bold">Disconnect</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<!--________________________________________-->
|
||||||
|
<!-- Connection modal -->
|
||||||
|
<!--________________________________________-->
|
||||||
|
<div id="modal_connection" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row center">
|
||||||
|
<div class="col s12">
|
||||||
|
<h3 class="" style="font-weight: bold">Sign in</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row center" style="margin-bottom: 0px">
|
||||||
|
<form name="login_form" id="login_form" action="javascript:void(0);" onsubmit="tryConnection()">
|
||||||
|
<div class="row" style="margin-bottom: 0px">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">account_box</i>
|
||||||
|
<input name="username" id="user_input" type="text" class="validate"/>
|
||||||
|
<label for="user_input" data-error="User not registered!">User Name</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">security</i>
|
||||||
|
<input name="password" id="password_input" type="password" class="validate"/>
|
||||||
|
<label for="password_input" data-error="Wrong password!">Password</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="margin-bottom: 10px">
|
||||||
|
<button id="btn-submit-connect" class="btn waves-effect waves-light light-green darken-1 scale-transition scale-out" type="submit" name="action" >
|
||||||
|
Submit<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a class="btn waves-effect waves-light brown" href="/register">
|
||||||
|
Create account<i class="material-icons right">person_add</i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
<!-- -->
|
||||||
|
<!-- END -->
|
||||||
|
<!-- -->
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="section no-pad-bot main" id="index-banner">
|
<div class="section no-pad-bot main" id="index-banner">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -48,14 +125,8 @@
|
|||||||
<!-- Scripts-->
|
<!-- Scripts-->
|
||||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||||
<script src="js/materialize.js"></script>
|
<script src="js/materialize.js"></script>
|
||||||
<script>
|
<script src="js/navabar.js"></script>
|
||||||
$('.button-collapse-1').sideNav({
|
<script src="js/js.cookie.js"></script>
|
||||||
menuWidth: 400, // Default is 300
|
|
||||||
edge: 'right', // Choose the horizontal origin
|
|
||||||
closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
|
|
||||||
draggable: true // Choose whether you can drag to open on touch screens,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<!--<script src="js/init.js"></script>-->
|
<!--<script src="js/init.js"></script>-->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
165
src/main/resources/static/js/js.cookie.js
Normal file
165
src/main/resources/static/js/js.cookie.js
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
/*!
|
||||||
|
* JavaScript Cookie v2.2.0
|
||||||
|
* https://github.com/js-cookie/js-cookie
|
||||||
|
*
|
||||||
|
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||||||
|
* Released under the MIT license
|
||||||
|
*/
|
||||||
|
;(function (factory) {
|
||||||
|
var registeredInModuleLoader = false;
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(factory);
|
||||||
|
registeredInModuleLoader = true;
|
||||||
|
}
|
||||||
|
if (typeof exports === 'object') {
|
||||||
|
module.exports = factory();
|
||||||
|
registeredInModuleLoader = true;
|
||||||
|
}
|
||||||
|
if (!registeredInModuleLoader) {
|
||||||
|
var OldCookies = window.Cookies;
|
||||||
|
var api = window.Cookies = factory();
|
||||||
|
api.noConflict = function () {
|
||||||
|
window.Cookies = OldCookies;
|
||||||
|
return api;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}(function () {
|
||||||
|
function extend () {
|
||||||
|
var i = 0;
|
||||||
|
var result = {};
|
||||||
|
for (; i < arguments.length; i++) {
|
||||||
|
var attributes = arguments[ i ];
|
||||||
|
for (var key in attributes) {
|
||||||
|
result[key] = attributes[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function init (converter) {
|
||||||
|
function api (key, value, attributes) {
|
||||||
|
var result;
|
||||||
|
if (typeof document === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
attributes = extend({
|
||||||
|
path: '/'
|
||||||
|
}, api.defaults, attributes);
|
||||||
|
|
||||||
|
if (typeof attributes.expires === 'number') {
|
||||||
|
var expires = new Date();
|
||||||
|
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
||||||
|
attributes.expires = expires;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We're using "expires" because "max-age" is not supported by IE
|
||||||
|
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = JSON.stringify(value);
|
||||||
|
if (/^[\{\[]/.test(result)) {
|
||||||
|
value = result;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (!converter.write) {
|
||||||
|
value = encodeURIComponent(String(value))
|
||||||
|
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||||
|
} else {
|
||||||
|
value = converter.write(value, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
key = encodeURIComponent(String(key));
|
||||||
|
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
||||||
|
key = key.replace(/[\(\)]/g, escape);
|
||||||
|
|
||||||
|
var stringifiedAttributes = '';
|
||||||
|
|
||||||
|
for (var attributeName in attributes) {
|
||||||
|
if (!attributes[attributeName]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stringifiedAttributes += '; ' + attributeName;
|
||||||
|
if (attributes[attributeName] === true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stringifiedAttributes += '=' + attributes[attributeName];
|
||||||
|
}
|
||||||
|
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read
|
||||||
|
|
||||||
|
if (!key) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// To prevent the for loop in the first place assign an empty array
|
||||||
|
// in case there are no cookies at all. Also prevents odd result when
|
||||||
|
// calling "get()"
|
||||||
|
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||||
|
var rdecode = /(%[0-9A-Z]{2})+/g;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (; i < cookies.length; i++) {
|
||||||
|
var parts = cookies[i].split('=');
|
||||||
|
var cookie = parts.slice(1).join('=');
|
||||||
|
|
||||||
|
if (!this.json && cookie.charAt(0) === '"') {
|
||||||
|
cookie = cookie.slice(1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var name = parts[0].replace(rdecode, decodeURIComponent);
|
||||||
|
cookie = converter.read ?
|
||||||
|
converter.read(cookie, name) : converter(cookie, name) ||
|
||||||
|
cookie.replace(rdecode, decodeURIComponent);
|
||||||
|
|
||||||
|
if (this.json) {
|
||||||
|
try {
|
||||||
|
cookie = JSON.parse(cookie);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === name) {
|
||||||
|
result = cookie;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!key) {
|
||||||
|
result[name] = cookie;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
api.set = api;
|
||||||
|
api.get = function (key) {
|
||||||
|
return api.call(api, key);
|
||||||
|
};
|
||||||
|
api.getJSON = function () {
|
||||||
|
return api.apply({
|
||||||
|
json: true
|
||||||
|
}, [].slice.call(arguments));
|
||||||
|
};
|
||||||
|
api.defaults = {};
|
||||||
|
|
||||||
|
api.remove = function (key, attributes) {
|
||||||
|
api(key, '', extend(attributes, {
|
||||||
|
expires: -1
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
api.withConverter = init;
|
||||||
|
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
|
return init(function () {});
|
||||||
|
}));
|
134
src/main/resources/static/js/navabar.js
Normal file
134
src/main/resources/static/js/navabar.js
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
var nav_bar_account_link;
|
||||||
|
var connected_link = "<a class=\"dropdown-account\" data-activates=\"dropdown_connected\"><i class=\"material-icons green-text\">account_box</i></a>";
|
||||||
|
var disconnected_link = "<a class=\"waves-effect waves-light modal-trigger\" href=\".modal_connection\"><i class=\"material-icons red-text\">account_box</i></a>";
|
||||||
|
var input_name;
|
||||||
|
var input_psw;
|
||||||
|
var btn_submit;
|
||||||
|
var btn_disconnect;
|
||||||
|
var nav_name;
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.button-navbar-mobile').sideNav({
|
||||||
|
menuWidth: 400, // Default is 300
|
||||||
|
edge: 'right', // Choose the horizontal origin
|
||||||
|
closeOnClick: false, // Closes side-nav on <a> clicks, useful for Angular/Meteor
|
||||||
|
draggable: true // Choose whether you can drag to open on touch screens,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
nav_bar_account_link = $("#nav-bar-account");
|
||||||
|
input_name = $("#user_input");
|
||||||
|
input_psw = $("#password_input");
|
||||||
|
btn_submit = $("#btn-submit-connect");
|
||||||
|
btn_disconnect = $("#nav-disconnect");
|
||||||
|
nav_name = $("#nav-name");
|
||||||
|
|
||||||
|
if(Cookies.get('token') === undefined){
|
||||||
|
disconnected()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
connected();
|
||||||
|
}
|
||||||
|
|
||||||
|
listeners();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function popOutSubmit(){
|
||||||
|
if (btn_submit.hasClass("scale-in")) {
|
||||||
|
btn_submit.removeClass("scale-in");
|
||||||
|
btn_submit.addClass("scale-out");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function popInSubmit(){
|
||||||
|
if (btn_submit.hasClass("scale-out")) {
|
||||||
|
btn_submit.removeClass("scale-out");
|
||||||
|
btn_submit.addClass("scale-in");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function connected(){
|
||||||
|
console.log("Connected!");
|
||||||
|
nav_bar_account_link.html(connected_link);
|
||||||
|
$('.dropdown-account').dropdown({
|
||||||
|
constrainWidth: false, // Does not change width of dropdown to that of the activator
|
||||||
|
belowOrigin: true, // Displays dropdown below the button
|
||||||
|
alignment: 'left', // Displays dropdown with edge aligned to the left of button
|
||||||
|
stopPropagation: false // Stops event propagation
|
||||||
|
}
|
||||||
|
);
|
||||||
|
nav_name.text(Cookies.get('name'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function disconnected() {
|
||||||
|
console.log("Disconnected");
|
||||||
|
nav_bar_account_link.html(disconnected_link);
|
||||||
|
$('.modal').modal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tryConnection() {
|
||||||
|
var request = { name: input_name.val(), password: input_psw.val()};
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json',
|
||||||
|
url: "/api/userManagement/requestToken",
|
||||||
|
data: JSON.stringify(request),
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
Cookies.set('token',data.token);
|
||||||
|
Cookies.set('name', data.name);
|
||||||
|
debugger;
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
}).fail(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
switch(data.responseJSON.error){
|
||||||
|
case "user":
|
||||||
|
input_name.addClass("invalid");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "password":
|
||||||
|
input_psw.addClass("invalid");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function listeners() {
|
||||||
|
input_name.on("input", function () {
|
||||||
|
if(input_name.val() !== "" && input_psw.val() !== "") {
|
||||||
|
popInSubmit();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
popOutSubmit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
input_psw.on("input", function () {
|
||||||
|
if(input_name.val() !== "" && input_psw.val() !== "") {
|
||||||
|
popInSubmit();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
popOutSubmit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btn_disconnect.click(function () {
|
||||||
|
Cookies.remove('token');
|
||||||
|
Cookies.remove('name');
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@ -15,13 +15,15 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('#name').on("input", function () {
|
$('#name').on("input", function () {
|
||||||
if($('#name').val() === ""){
|
if($('#name').val() === ""){
|
||||||
if (!sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-in")) {
|
||||||
sendBtn.addClass("disabled");
|
sendBtn.removeClass("scale-in");
|
||||||
|
sendBtn.addClass("scale-out");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (sendBtn.hasClass("disabled") && ok_passwrd) {
|
if (sendBtn.hasClass("scale-out") && ok_passwrd) {
|
||||||
sendBtn.removeClass("disabled");
|
sendBtn.removeClass("scale-out");
|
||||||
|
sendBtn.addClass("scale-in");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -40,8 +42,9 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if($('#name').val() !== ""){
|
if($('#name').val() !== ""){
|
||||||
if (sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-out")) {
|
||||||
sendBtn.removeClass("disabled");
|
sendBtn.removeClass("scale-out");
|
||||||
|
sendBtn.addClass("scale-in");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ok_passwrd = true;
|
ok_passwrd = true;
|
||||||
@ -54,8 +57,9 @@ $(document).ready(function() {
|
|||||||
confirm.removeClass("valid");
|
confirm.removeClass("valid");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-in")) {
|
||||||
sendBtn.addClass("disabled");
|
sendBtn.removeClass("scale-in");
|
||||||
|
sendBtn.addClass("scale-out");
|
||||||
}
|
}
|
||||||
ok_passwrd = false;
|
ok_passwrd = false;
|
||||||
}
|
}
|
||||||
@ -71,8 +75,9 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if($('#name').val() !== ""){
|
if($('#name').val() !== ""){
|
||||||
if (sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-out")) {
|
||||||
sendBtn.removeClass("disabled");
|
sendBtn.removeClass("scale-out");
|
||||||
|
sendBtn.addClass("scale-in");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ok_passwrd = true;
|
ok_passwrd = true;
|
||||||
@ -85,8 +90,9 @@ $(document).ready(function() {
|
|||||||
confirm.removeClass("valid");
|
confirm.removeClass("valid");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-in")) {
|
||||||
sendBtn.addClass("disabled");
|
sendBtn.removeClass("scale-in");
|
||||||
|
sendBtn.addClass("scale-out");
|
||||||
}
|
}
|
||||||
ok_passwrd = false;
|
ok_passwrd = false;
|
||||||
}
|
}
|
||||||
@ -132,13 +138,15 @@ $(document).ready(function() {
|
|||||||
$('#input_preToken').on("input", function () {
|
$('#input_preToken').on("input", function () {
|
||||||
var sendBtn = $('#preTokenSend');
|
var sendBtn = $('#preTokenSend');
|
||||||
if($('#input_preToken').val().length < 4){
|
if($('#input_preToken').val().length < 4){
|
||||||
if (!sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-in")) {
|
||||||
sendBtn.addClass("disabled");
|
sendBtn.removeClass("scale-in");
|
||||||
|
sendBtn.addClass("scale-out");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (sendBtn.hasClass("disabled")) {
|
if (sendBtn.hasClass("scale-out")) {
|
||||||
sendBtn.removeClass("disabled");
|
sendBtn.removeClass("scale-out");
|
||||||
|
sendBtn.addClass("scale-in");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -16,31 +16,106 @@
|
|||||||
|
|
||||||
<body class="blue-grey lighten-5" >
|
<body class="blue-grey lighten-5" >
|
||||||
|
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
<!-- NAV BAR -->
|
||||||
|
<!-- AND -->
|
||||||
|
<!-- LOGIN -->
|
||||||
|
<!--__________________________________________________________-->
|
||||||
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
|
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
|
||||||
<div class="nav-wrapper container">
|
<div class="nav-wrapper container">
|
||||||
<a id="logo-container" href="/" class="brand-logo">Discord Bot</a>
|
<a id="logo-container" href="#" class="brand-logo">Discord Bot</a>
|
||||||
<ul class="right hide-on-med-and-down">
|
<ul class="right hide-on-med-and-down">
|
||||||
|
|
||||||
<li >
|
<li class="">
|
||||||
<a href="/" data-target="slide-out" class="sidenav-trigger">Home</a>
|
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="/music" >Music Control</a>
|
<a class="waves-effect waves-light" href="/music" >Music Control</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li id="nav-bar-account">
|
||||||
|
<a class="dropdown-account" data-activates="dropdown1"><i class="material-icons">account_box</i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="side-nav">
|
<ul id="nav-mobile" class="side-nav">
|
||||||
<li >
|
|
||||||
<a href="/" data-target="slide-out" class="sidenav-trigger">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="/music" data-target="slide-out" class="sidenav-trigger">Music Control</a>
|
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="waves-effect waves-light sidenav-trigger" href="/music" data-target="slide-out" >Music Control</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<a href="#" data-activates="nav-mobile" class="button-collapse-1 button-collapse"><i class="material-icons">menu</i></a>
|
<a href="#" data-activates="nav-mobile" class="button-navbar-mobile button-collapse"><i class="material-icons">menu</i></a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<!-- Dropdown connected -->
|
||||||
|
<ul id="dropdown_connected" class="dropdown-content ">
|
||||||
|
<li>
|
||||||
|
<a class="center blue-grey-text text-darken-4" id="nav-name" style="text-decoration: underline; font-weight: bold"></a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li>
|
||||||
|
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Account</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Playlists</a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a class="center red-text" id="nav-disconnect" style="font-weight: bold">Disconnect</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<!--________________________________________-->
|
||||||
|
<!-- Connection modal -->
|
||||||
|
<!--________________________________________-->
|
||||||
|
<div id="modal_connection" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row center">
|
||||||
|
<div class="col s12">
|
||||||
|
<h3 class="" style="font-weight: bold">Sign in</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row center" style="margin-bottom: 0px">
|
||||||
|
<form name="login_form" id="login_form" action="javascript:void(0);" onsubmit="tryConnection()">
|
||||||
|
<div class="row" style="margin-bottom: 0px">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">account_box</i>
|
||||||
|
<input name="username" id="user_input" type="text" class="validate"/>
|
||||||
|
<label for="user_input" data-error="User not registered!">User Name</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">security</i>
|
||||||
|
<input name="password" id="password_input" type="password" class="validate"/>
|
||||||
|
<label for="password_input" data-error="Wrong password!">Password</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="margin-bottom: 10px">
|
||||||
|
<button id="btn-submit-connect" class="btn waves-effect waves-light light-green darken-1 scale-transition scale-out" type="submit" name="action" >
|
||||||
|
Submit<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a class="btn waves-effect waves-light brown" href="/register">
|
||||||
|
Create account<i class="material-icons right">person_add</i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
<!-- -->
|
||||||
|
<!-- END -->
|
||||||
|
<!-- -->
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
|
||||||
<div class="section no-pad-bot main" id="index-banner">
|
<div class="section no-pad-bot main" id="index-banner">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s8">
|
<div class="col s8">
|
||||||
@ -217,6 +292,8 @@
|
|||||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||||
<script src="js/materialize.js"></script>
|
<script src="js/materialize.js"></script>
|
||||||
<script src="js/init.js"></script>
|
<script src="js/init.js"></script>
|
||||||
|
<script src="js/navabar.js"></script>
|
||||||
|
<script src="js/js.cookie.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,131 +1,210 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
||||||
<title>User Registration - Discord Bot</title>
|
<title>User Registration - Discord Bot</title>
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
|
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
|
||||||
|
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
|
||||||
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
||||||
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="blue-grey lighten-5" >
|
<body class="blue-grey lighten-5" >
|
||||||
|
|
||||||
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
|
<!--__________________________________________________________-->
|
||||||
<div class="nav-wrapper container">
|
<!-- NAV BAR -->
|
||||||
<a id="logo-container" href="#" class="brand-logo">Discord Bot</a>
|
<!-- AND -->
|
||||||
<ul class="right hide-on-med-and-down">
|
<!-- LOGIN -->
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
<nav class="blue-grey darken-4 z-depth-3" role="navigation">
|
||||||
|
<div class="nav-wrapper container">
|
||||||
|
<a id="logo-container" href="#" class="brand-logo">Discord Bot</a>
|
||||||
|
<ul class="right hide-on-med-and-down">
|
||||||
|
|
||||||
<li>
|
<li class="">
|
||||||
<a href="/" data-target="slide-out" class="sidenav-trigger">Home</a>
|
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/music" >Music Control</a>
|
<a class="waves-effect waves-light" href="/music" >Music Control</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
<li id="nav-bar-account">
|
||||||
|
<a class="dropdown-account" data-activates="dropdown1"><i class="material-icons">account_box</i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="side-nav">
|
</ul>
|
||||||
<li>
|
|
||||||
<a href="/" data-target="slide-out" class="sidenav-trigger">Home</a>
|
<ul id="nav-mobile" class="side-nav">
|
||||||
</li>
|
<li class="active">
|
||||||
<li>
|
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||||
<a href="/music" data-target="slide-out" class="sidenav-trigger">Music Control</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
</ul>
|
<a class="waves-effect waves-light sidenav-trigger" href="/music" data-target="slide-out" >Music Control</a>
|
||||||
<a href="#" data-activates="nav-mobile" class="button-collapse-1 button-collapse"><i class="material-icons">menu</i></a>
|
</li>
|
||||||
</div>
|
</ul>
|
||||||
</nav>
|
<a href="#" data-activates="nav-mobile" class="button-navbar-mobile button-collapse"><i class="material-icons">menu</i></a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- Dropdown connected -->
|
||||||
|
<ul id="dropdown_connected" class="dropdown-content ">
|
||||||
|
<li>
|
||||||
|
<a class="center blue-grey-text text-darken-4" id="nav-name" style="text-decoration: underline; font-weight: bold"></a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li>
|
||||||
|
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Account</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Playlists</a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a class="center red-text" id="nav-disconnect" style="font-weight: bold">Disconnect</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<div class="section no-pad-bot main" id="index-banner">
|
<!--________________________________________-->
|
||||||
|
<!-- Connection modal -->
|
||||||
|
<!--________________________________________-->
|
||||||
|
<div id="modal_connection" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
<div class="row center">
|
<div class="row center">
|
||||||
<div class="row">
|
|
||||||
<h2 class="col s12">Account Registration</h2>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 0%">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="input-field inline">
|
|
||||||
<i class="material-icons prefix">assignment_ind</i>
|
|
||||||
<input id="name" type="text" class="validate invalid"></input>
|
|
||||||
<label for="name" data-error="" data-success="">Discord Name</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 0%">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="input-field inline">
|
|
||||||
<i class="material-icons prefix">security</i>
|
|
||||||
<input id="passwrd" type="password" class="invalid"></input>
|
|
||||||
<label for="passwrd" data-error="" data-success="">Password</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="margin-bottom: 0%">
|
|
||||||
<div class="col s12">
|
|
||||||
<div class="input-field inline">
|
|
||||||
<i class="material-icons prefix">security</i>
|
|
||||||
<input id="passwrd2" type="password" class="invalid"></input>
|
|
||||||
<label for="passwrd2" data-error="" data-success="">Confirm</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<a id="sendBtn" class="waves-effect waves-light btn disabled">Send<i class="material-icons left">send</i></a>
|
<h3 class="" style="font-weight: bold">Sign in</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row center" style="margin-bottom: 0px">
|
||||||
|
<form name="login_form" id="login_form" action="javascript:void(0);" onsubmit="tryConnection()">
|
||||||
|
<div class="row" style="margin-bottom: 0px">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">account_box</i>
|
||||||
|
<input name="username" id="user_input" type="text" class="validate"/>
|
||||||
|
<label for="user_input" data-error="User not registered!">User Name</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">security</i>
|
||||||
|
<input name="password" id="password_input" type="password" class="validate"/>
|
||||||
|
<label for="password_input" data-error="Wrong password!">Password</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="margin-bottom: 10px">
|
||||||
|
<button id="btn-submit-connect" class="btn waves-effect waves-light light-green darken-1 scale-transition scale-out" type="submit" name="action" >
|
||||||
|
Submit<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a class="btn waves-effect waves-light brown" href="/register">
|
||||||
|
Create account<i class="material-icons right">person_add</i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
<!-- -->
|
||||||
|
<!-- END -->
|
||||||
|
<!-- -->
|
||||||
|
<!--__________________________________________________________-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="section no-pad-bot main" id="index-banner">
|
||||||
<!-- Modal Structure -->
|
<div class="row center">
|
||||||
<div id="modalToken" class="modal">
|
<div class="row">
|
||||||
<div class="modal-content">
|
<h2 class="col s12">Account Registration</h2>
|
||||||
<div class="row">
|
</div>
|
||||||
<h3 class="col s12 center"> User Validation</h3>
|
<div class="row" style="margin-bottom: 0%">
|
||||||
</div>
|
<div class="col s12">
|
||||||
<div class="row">
|
<div class="input-field inline">
|
||||||
<div class="col s10 offset-s1">
|
<i class="material-icons prefix">assignment_ind</i>
|
||||||
<p class="center">
|
<input id="name" type="text" class="validate invalid"/>
|
||||||
A validation code was sent by private message, please copy it below.
|
<label for="name" data-error="" data-success="">Discord Name</label>
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col s12">
|
<div class="row" style="margin-bottom: 0%">
|
||||||
<div class="row" style="margin-bottom: 0px">
|
<div class="col s12">
|
||||||
<div class="input-field col s6 offset-s3">
|
<div class="input-field inline">
|
||||||
<i class="material-icons prefix">fingerprint</i>
|
<i class="material-icons prefix">security</i>
|
||||||
<input id="input_preToken" type="text" class="validate"/>
|
<input id="passwrd" type="password" class="invalid"/>
|
||||||
<label for="input_preToken">Verification Code</label>
|
<label for="passwrd" data-error="" data-success="">Password</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="margin-bottom: 0%">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="input-field inline">
|
||||||
|
<i class="material-icons prefix">security</i>
|
||||||
|
<input id="passwrd2" type="password" class="invalid"/>
|
||||||
|
<label for="passwrd2" data-error="" data-success="">Confirm</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col s12">
|
||||||
|
<a id="sendBtn" class="waves-effect waves-light btn scale-transition scale-out">Send<i class="material-icons left">send</i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal Structure -->
|
||||||
|
<div id="modalToken" class="modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<h3 class="col s12 center"> User Validation</h3>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s10 offset-s1">
|
||||||
|
<p class="center">
|
||||||
|
A validation code was sent by private message, please copy it below.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="row" style="margin-bottom: 0px">
|
||||||
|
<div class="input-field col s6 offset-s3">
|
||||||
|
<i class="material-icons prefix">fingerprint</i>
|
||||||
|
<input id="input_preToken" type="text" class="validate"/>
|
||||||
|
<label for="input_preToken">Verification Code</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
|
||||||
<a href="#!" id="preTokenSend" class="modal-action waves-effect waves-green btn disabled">Send</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#!" id="preTokenSend" class="modal-action waves-effect waves-green btn disabled">Send</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||||
<script src="js/materialize.js"></script>
|
<script src="js/materialize.js"></script>
|
||||||
<script src="js/register.js"></script>
|
<script src="js/register.js"></script>
|
||||||
|
<script src="js/navabar.js"></script>
|
||||||
|
<script src="js/js.cookie.js"></script>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
|
||||||
/*<![CDATA[*/
|
|
||||||
|
|
||||||
var id = [[${id}]];
|
<script th:inline="javascript">
|
||||||
console.log(id);
|
/*<![CDATA[*/
|
||||||
|
|
||||||
/*]]>*/
|
var id = [[${id}]];
|
||||||
</script>
|
console.log(id);
|
||||||
</body>
|
|
||||||
|
/*]]>*/
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user