mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-03-21 17:24:28 -05:00
client js login system + login card styling + fixed template issues
This commit is contained in:
parent
6ca84aefa3
commit
63643c73d5
2
.eslintignore
Normal file
2
.eslintignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# web javascript causes a lot of eslint warnings
|
||||
assets/js/*.js
|
||||
|
|
@ -3,6 +3,19 @@ body.flex.center {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
body footer {
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
body footer .content {
|
||||
border-radius: 0;
|
||||
background-color: transparent;
|
||||
padding: 1em 0;
|
||||
box-shadow: none;
|
||||
width: 30rem;
|
||||
max-width: 100vw;
|
||||
}
|
||||
|
||||
/* login/register card */
|
||||
.card {
|
||||
background-color: white;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
function postAjax(url, data, success) {
|
||||
var params = (typeof data == 'string') ? data : Object.keys(data).map(function (k) {
|
||||
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k])
|
||||
}).join('&');
|
||||
|
||||
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
|
||||
xhr.open('POST', url);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.send(params);
|
||||
return xhr;
|
||||
}
|
||||
|
||||
function login() {
|
||||
var xhr = postAjax('/api/v1/login', {
|
||||
email: document.getElementById('email_input').value,
|
||||
password: document.getElementById('password_input').value
|
||||
});
|
||||
xhr.onload = function () {
|
||||
console.log(xhr.responseText);
|
||||
response = JSON.parse(xhr.responseText);
|
||||
if (response.success === true) {
|
||||
location.pathname = '/pnid/dashboard';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
<a href="/admin/api/v1/check">Check if logged in</a>
|
||||
<br>
|
||||
<a href="/admin/api/v1/logout">Logout</a>
|
||||
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<p class="txt-highlight">ERROR</p>
|
||||
<h1 class="txt-title small">ERROR</h1>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -14,13 +14,14 @@
|
|||
<h1 class="txt-title small">{{ locales.login_card.title }}</h1>
|
||||
<form action="/api/v1/sendmessage" method="POST">
|
||||
<label for="email">{{ locales.login_card.email_text }}</label>
|
||||
<input type="text" class="hasLabel" id="email" name="email">
|
||||
<input type="text" class="hasLabel" id="email_input" name="email">
|
||||
<label for="email">{{ locales.login_card.password_text }}</label>
|
||||
<input type="password" class="hasLabel" id="password" name="password">
|
||||
<input type="password" class="hasLabel" id="password_input" name="password">
|
||||
</form>
|
||||
<button class="btn btnMargin">{{ locales.login_card.button_text }}</button>
|
||||
<button class="btn btnMargin" onclick="login()">{{ locales.login_card.button_text }}</button>
|
||||
<p class="lowText">ERROR <a href="#">ERROR</a></p>
|
||||
</div>
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
</div>
|
||||
<footer>
|
||||
<div class="content">
|
||||
<p>{{ locales.footer.text }}</p>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
-->
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user