Auth pages
This commit is contained in:
parent
0c47a9037d
commit
710cd981aa
5 changed files with 258 additions and 85 deletions
|
@ -51,10 +51,11 @@ Main::init($sakuraConf);
|
||||||
// Set base page rendering data
|
// Set base page rendering data
|
||||||
$renderData = array(
|
$renderData = array(
|
||||||
'sakura' => [
|
'sakura' => [
|
||||||
'version' => SAKURA_VERSION,
|
'version' => SAKURA_VERSION,
|
||||||
'urls' => Configuration::getLocalConfig('urls'),
|
'urls' => Configuration::getLocalConfig('urls'),
|
||||||
'charset' => Configuration::getConfig('charset'),
|
'charset' => Configuration::getConfig('charset'),
|
||||||
'currentpage' => $_SERVER['PHP_SELF']
|
'currentpage' => $_SERVER['PHP_SELF'],
|
||||||
|
'recaptcha_public' => Configuration::getConfig('recaptcha_public')
|
||||||
],
|
],
|
||||||
'php' => [
|
'php' => [
|
||||||
'sessionid' => \session_id(),
|
'sessionid' => \session_id(),
|
||||||
|
|
|
@ -1,80 +1,81 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<!-- META -->
|
<!-- META -->
|
||||||
<meta charset="{{ sakura.charset }}" />
|
<meta charset="{{ sakura.charset }}" />
|
||||||
<title>{{ page.title }}</title>
|
<title>{{ page.title }}</title>
|
||||||
<meta name="description" content="Any community that gets its laughs by pretending to be idiots will eventually be flooded by actual idiots who mistakenly believe that they're in good company. Welcome to Flashii." />
|
<meta name="description" content="Any community that gets its laughs by pretending to be idiots will eventually be flooded by actual idiots who mistakenly believe that they're in good company. Welcome to Flashii." />
|
||||||
<meta name="keywords" content="Flashii, Media, Flashwave, Murasaki, Misaka, Circle, Zeniea, MalwareUp, Cybernetics, Saibateku, Community" />
|
<meta name="keywords" content="Flashii, Media, Flashwave, Murasaki, Misaka, Circle, Zeniea, MalwareUp, Cybernetics, Saibateku, Community" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||||
<!-- CSS -->
|
<!-- CSS -->
|
||||||
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css" />
|
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/global.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/css/yuuno/yuuno.css" />
|
<link rel="stylesheet" type="text/css" href="//{{ sakura.urls.content }}/css/yuuno/yuuno.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
||||||
<!-- JS -->
|
<!-- JS -->
|
||||||
<script type="text/javascript" src="//{{ sakura.urls.content }}/js/yuuno.js"></script>
|
<script type="text/javascript" src="//{{ sakura.urls.content }}/js/yuuno.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{% if user.loggedin != true %}
|
{% if user.loggedin != true %}
|
||||||
// Setting the shit so clicking the login link doesn't redirect to /login
|
// Setting the shit so clicking the login link doesn't redirect to /login
|
||||||
function initLoginForm() {
|
function initLoginForm() {
|
||||||
|
|
||||||
var headerLoginLink = document.getElementById('headerLoginLink');
|
var headerLoginLink = document.getElementById('headerLoginLink');
|
||||||
|
|
||||||
headerLoginLink.setAttribute('href', 'javascript:;');
|
headerLoginLink.setAttribute('href', 'javascript:;');
|
||||||
headerLoginLink.setAttribute('onclick', 'toggleLoginForm();');
|
headerLoginLink.setAttribute('onclick', 'toggleLoginForm();');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggling the dynamic login form
|
// Toggling the dynamic login form
|
||||||
function toggleLoginForm() {
|
function toggleLoginForm() {
|
||||||
|
|
||||||
var headerLoginForm = document.getElementById('headerLoginForm');
|
var headerLoginForm = document.getElementById('headerLoginForm');
|
||||||
|
|
||||||
headerLoginForm.className = (headerLoginForm.className == 'hidden' ? '' : 'hidden');
|
headerLoginForm.className = (headerLoginForm.className == 'hidden' ? '' : 'hidden');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute initLoginForm() on load
|
// Execute initLoginForm() on load
|
||||||
window.onload = function(){initLoginForm();};
|
window.onload = function(){initLoginForm();};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<span id="top"></span>
|
<span id="top"></span>
|
||||||
<div class="header" id="header">
|
<div class="header" id="header">
|
||||||
<a class="logo" href="/"></a>
|
<a class="logo" href="/"></a>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<div class="menu-nav" id="navMenuSite">
|
<div class="menu-nav" id="navMenuSite">
|
||||||
<!-- Navigation menu, displayed on left side of the bar. -->
|
<!-- Navigation menu, displayed on left side of the bar. -->
|
||||||
<a class="menu-item" href="http://{{ sakura.urls.main }}/" title="Return to the front page of Flashii">Home</a>
|
<a class="menu-item" href="http://{{ sakura.urls.main }}/" title="Return to the front page of Flashii">Home</a>
|
||||||
<a class="menu-item" href="http://{{ sakura.urls.main }}/news" title="Here you can read updates on Flashii">News</a>
|
<a class="menu-item" href="http://{{ sakura.urls.main }}/news" title="Here you can read updates on Flashii">News</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-ucp" id="navMenuUser">
|
<div class="menu-ucp" id="navMenuUser">
|
||||||
<!-- User menu, displayed on right side of the bar. -->
|
<!-- User menu, displayed on right side of the bar. -->
|
||||||
<a class="menu-item" id="headerLoginLink" href="http://{{ sakura.urls.main }}/login" title="Login to Flashii">Login</a>
|
<a class="menu-item" id="headerLoginLink" href="http://{{ sakura.urls.main }}/login" title="Login to Flashii">Login</a>
|
||||||
<a class="menu-item" href="http://{{ sakura.urls.main }}/register" title="Create an account">Register</a>
|
<a class="menu-item" href="http://{{ sakura.urls.main }}/register" title="Create an account">Register</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-mob">
|
<div class="menu-mob">
|
||||||
<a class="menu-item" id="mobileNavToggle" href="javascript:;" onclick="mobileMenu(true);">Open Menu</a>
|
<a class="menu-item" id="mobileNavToggle" href="javascript:;" onclick="mobileMenu(true);">Open Menu</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="contentwrapper">
|
<div id="contentwrapper">
|
||||||
{% if user.loggedin != true %}
|
{% if user.loggedin != true %}
|
||||||
<div class="hidden" id="headerLoginForm">
|
<div class="hidden" id="headerLoginForm">
|
||||||
<form method="post" action="/login">
|
<form method="post" action="/authenticate">
|
||||||
<input type="hidden" name="redirect" value="{{ sakura.currentpage }}" />
|
<input type="hidden" name="redirect" value="{{ sakura.currentpage }}" />
|
||||||
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
<input type="hidden" name="time" value="{{ php.time }}" />
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
<label for="headerLoginUserName">Username:</label>
|
<input type="hidden" name="mode" value="login" />
|
||||||
<input type="text" id="headerLoginUserName" name="username" class="inputStyling" placeholder="Username" />
|
<label for="headerLoginUserName">Username:</label>
|
||||||
<label for="headerLoginPassword">Password:</label>
|
<input type="text" id="headerLoginUserName" name="username" class="inputStyling" placeholder="Username" />
|
||||||
<input type="password" id="headerLoginPassword" name="password" class="inputStyling" placeholder="Password" />
|
<label for="headerLoginPassword">Password:</label>
|
||||||
<input type="checkbox" name="remember" id="headerLoginRemember" />
|
<input type="password" id="headerLoginPassword" name="password" class="inputStyling" placeholder="Password" />
|
||||||
<label for="headerLoginRemember">Remember me</label>
|
<input type="checkbox" name="remember" id="headerLoginRemember" />
|
||||||
<input type="submit" id="headerLoginButton" name="submit" class="inputStyling small" value="Login" />
|
<label for="headerLoginRemember">Remember me</label>
|
||||||
</form>
|
<input type="submit" id="headerLoginButton" name="submit" class="inputStyling small" value="Login" />
|
||||||
</div>
|
</form>
|
||||||
{% endif %}
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
138
_sakura/templates/yuuno/main/authenticate.tpl
Normal file
138
_sakura/templates/yuuno/main/authenticate.tpl
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
{% include 'global/header.tpl' %}
|
||||||
|
<div class="loginPage">
|
||||||
|
{% if auth.redirect == sakura.urls.chat %}<h1 class="stylised" style="line-height: 1.8em; text-align: center;">You need to be logged in to use the chat.</h1>{% endif %}
|
||||||
|
<div class="loginCont">
|
||||||
|
<div class="loginForm">
|
||||||
|
<div class="head">
|
||||||
|
Login to Flashii
|
||||||
|
</div>
|
||||||
|
<form method="post" action="http://{{ sakura.urls.main }}/authenticate">
|
||||||
|
<input type="hidden" name="redirect" value="{{ auth.redirect }}" />
|
||||||
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
<input type="hidden" name="mode" value="login" />
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="loginUserName">Username:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="text" id="loginUserName" name="username" autofocus="true" />
|
||||||
|
</div>
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="loginPassword">Password:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="password" id="loginPassword" name="password" />
|
||||||
|
</div>
|
||||||
|
<div class="subLinks centreAlign">
|
||||||
|
<input class="inputStyling" name="remember" type="checkbox" class="ignore-css" id="loginRemember" /><label for="loginRemember">Remember Me</a>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="submit" id="loginButton" name="submit" value="Login" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="passwordForm">
|
||||||
|
<div class="head">
|
||||||
|
Lost Password
|
||||||
|
</div>
|
||||||
|
<form method="post" action="http://{{ sakura.urls.main }}/authenticate">
|
||||||
|
<input type="hidden" name="mode" value="forgotpassword" />
|
||||||
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="forgotUserName">Username:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="text" id="forgotUserName" name="username" />
|
||||||
|
</div>
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="forgotEmail">E-mail:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="text" id="forgotEmail" name="email" />
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="submit" name="submit" value="Request Password" />
|
||||||
|
</div>
|
||||||
|
<div class="subLinks centreAlign">
|
||||||
|
If you lost access to your e-mail address please <a href="/contact" class="default" target="_blank">contact us</a>.
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="registerForm">
|
||||||
|
<div class="head">
|
||||||
|
Register on Flashii
|
||||||
|
</div>
|
||||||
|
<form id="registerForm" method="post" action="http://{{ sakura.urls.main }}/authenticate" style="display:{% if auth.blockRegister.do %}none{% else %}block{% endif %};">
|
||||||
|
<input type="hidden" name="mode" value="register" />
|
||||||
|
<input type="hidden" name="session" value="{{ php.sessionid }}" />
|
||||||
|
<input type="hidden" name="time" value="{{ php.time }}" />
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="registerUserName">Username:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="text" id="registerUserName" name="username" placeholder="Any character" />
|
||||||
|
</div>
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="registerEmail">E-mail:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="text" id="registerEmail" name="email" placeholder="Used for e.g. password retrieval" />
|
||||||
|
</div>
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="registerPassword">Password:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="password" id="registerPassword" name="password" placeholder="Must be at least 5 characters." />
|
||||||
|
</div>
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="registerConfirmPassword">Confirm Password:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="password" id="registerConfirmPassword" name="confirmpassword" placeholder="Just to make sure" />
|
||||||
|
</div>
|
||||||
|
<div class="leftAlign">
|
||||||
|
<label for="recaptcha_response_field">Verification:</label>
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
||||||
|
<div class="g-recaptcha" data-sitekey="{{ sakura.recaptcha_public }}" style="margin: auto; display: inline-block;"></div>
|
||||||
|
<noscript>
|
||||||
|
<div style="width: 302px; height: 352px; margin: auto; display: inline-block;">
|
||||||
|
<div style="width: 302px; height: 352px; position: relative;">
|
||||||
|
<div style="width: 302px; height: 352px; position: absolute;">
|
||||||
|
<iframe src="https://www.google.com/recaptcha/api/fallback?k={{ sakura.recaptcha_public }}" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;"></iframe>
|
||||||
|
</div>
|
||||||
|
<div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">
|
||||||
|
<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;" value=""></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
</div>
|
||||||
|
<div class="subLinks centreAlign">
|
||||||
|
<input class="inputStyling" name="tos" type="checkbox" class="ignore-css" id="registerToS" /><label for="registerToS">I agree to the <a class="default" href="/r/terms" target="_blank">Terms of Service</a>.
|
||||||
|
</div>
|
||||||
|
<div class="centreAlign">
|
||||||
|
<input class="inputStyling" type="submit" name="submit" value="Register" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% if auth.blockRegister.do %}
|
||||||
|
<div class="registerForm" id="registerWarn" style="display: block;">
|
||||||
|
<div class="centreAlign">
|
||||||
|
<div class="fa fa-warning fa-5x" style="display: block; margin: 10px 0 0;"></div>
|
||||||
|
<h1>Are you {{ auth.blockRegister.username }}?</h1>
|
||||||
|
<p>Making more than one account is not permitted.</p>
|
||||||
|
<p>If you lost your password please use the form on the bottom left but if you don't already have an account you can go ahead and click the link below to show the registration form this check is based on your IP so in some cases someone may have registered/used the site on this IP already.</p>
|
||||||
|
<p>If we find out that you already have an account we may question you about it, if you can give a good reason we'll let it slide otherwise we may issue a temporary ban.</p>
|
||||||
|
</div>
|
||||||
|
<div class="subLinks centreAlign">
|
||||||
|
<a href="javascript:;" class="default" onclick="document.getElementById('registerWarn').style.display='none';document.getElementById('registerForm').style.display='block';">Register anyway</a>.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
{% include 'global/footer.tpl' %}
|
|
@ -17,7 +17,7 @@ Options +FollowSymLinks -Indexes
|
||||||
RewriteRule ^feedback?/?$ http://forum.flash.moe/viewforum.php?f=22
|
RewriteRule ^feedback?/?$ http://forum.flash.moe/viewforum.php?f=22
|
||||||
RewriteRule ^credits?/?$ credits.php
|
RewriteRule ^credits?/?$ credits.php
|
||||||
RewriteRule ^index?/?$ index.php
|
RewriteRule ^index?/?$ index.php
|
||||||
RewriteRule ^login?/?$|register?/?$|forgotpassword?/?$ authenticate.php
|
RewriteRule ^login?/?$|register?/?$|forgotpassword?/?|authenticate?/?$ authenticate.php
|
||||||
RewriteRule ^donate?/?$ donate.php
|
RewriteRule ^donate?/?$ donate.php
|
||||||
RewriteRule ^contact?/?$ contact.php
|
RewriteRule ^contact?/?$ contact.php
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Sakura Authentication Page
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Declare Namespace
|
||||||
|
namespace Sakura;
|
||||||
|
|
||||||
|
// Include components
|
||||||
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||||
|
|
||||||
|
// Add page specific things
|
||||||
|
$renderData['page'] = [
|
||||||
|
'title' => 'Login to Flashii'
|
||||||
|
];
|
||||||
|
$renderData['auth'] = [
|
||||||
|
'redirect' => (
|
||||||
|
isset($_REQUEST['chat']) ?
|
||||||
|
Configuration::getLocalConfig('urls', 'chat') :
|
||||||
|
(
|
||||||
|
isset($_SERVER['HTTP_REFERER']) ?
|
||||||
|
$_SERVER['HTTP_REFERER'] :
|
||||||
|
Configuration::getLocalConfig('urls', 'main')
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'blockRegister' => [
|
||||||
|
'do' => true,
|
||||||
|
'username' => 'test'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Print page contents
|
||||||
|
print Main::tplRender('main/authenticate.tpl', $renderData);
|
Reference in a new issue