Tidied up login page/navbar.
This commit is contained in:
parent
478edeeddf
commit
3eddd0ea5b
|
|
@ -29,6 +29,12 @@ module.exports.get = async function(req, res){
|
||||||
//Check for validation errors
|
//Check for validation errors
|
||||||
const validResult = validationResult(req);
|
const validResult = validationResult(req);
|
||||||
|
|
||||||
|
//If this request is coming from someone who's already logged in
|
||||||
|
if(req.session.user != null){
|
||||||
|
//Redirect them to the homepage
|
||||||
|
return res.redirect('/');
|
||||||
|
}
|
||||||
|
|
||||||
//If there are none
|
//If there are none
|
||||||
if(validResult.isEmpty()){
|
if(validResult.isEmpty()){
|
||||||
//Get username from sanatized/validated data
|
//Get username from sanatized/validated data
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%- include('partial/navbar', {user}); %>
|
<%- include('partial/navbar', {user}); %>
|
||||||
|
<h2>User Login</h2>
|
||||||
<% if(challenge != null){ %>
|
<% if(challenge != null){ %>
|
||||||
<h3 class="danger-text">Multiple failed attempts detected!</h3>
|
<h3 class="danger-text">Multiple failed attempts detected!</h3>
|
||||||
<p class="danger-text">Please complete verification challenge to continue!</p>
|
<p class="danger-text">Please complete verification challenge to continue!</p>
|
||||||
|
|
@ -36,6 +37,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.-->
|
||||||
<% if(challenge != null){ %>
|
<% if(challenge != null){ %>
|
||||||
<altcha-widget challengejson="<%= JSON.stringify(challenge) %>"></altcha-widget>
|
<altcha-widget challengejson="<%= JSON.stringify(challenge) %>"></altcha-widget>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<a href="/register">Create New Account</a>
|
||||||
|
<a href="/passwordReset">Forgot Password</a>
|
||||||
<button id="login-page-button" class='positive-button'>Login</button>
|
<button id="login-page-button" class='positive-button'>Login</button>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.-->
|
||||||
<% }else{ %>
|
<% }else{ %>
|
||||||
<input class="navbar-item login-prompt" id="username-prompt" placeholder="username">
|
<input class="navbar-item login-prompt" id="username-prompt" placeholder="username">
|
||||||
<input class="navbar-item login-prompt" id="password-prompt" placeholder="password" type="password">
|
<input class="navbar-item login-prompt" id="password-prompt" placeholder="password" type="password">
|
||||||
<p class="navbar-item"><a class="navbar-item" href="javascript:" id="login-button">Login</a> - <a class="navbar-item" href="/register">Register</a></p>
|
<p class="navbar-item"><a class="navbar-item" href="javascript:" id="login-button">Login</a> - <a class="navbar-item" href="/passwordReset">Forgot Password</a> - <a class="navbar-item" href="/register">Register</a></p>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -13,12 +13,16 @@ GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||||
|
h2{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
form{
|
form{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
margin: 5% 17%;
|
margin: 0 17%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-page-prompt{
|
.login-page-prompt{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,12 @@ async function navbarLogin(event){
|
||||||
var user = document.querySelector("#username-prompt").value;
|
var user = document.querySelector("#username-prompt").value;
|
||||||
var pass = document.querySelector("#password-prompt").value;
|
var pass = document.querySelector("#password-prompt").value;
|
||||||
|
|
||||||
|
//If no user or pass is presented
|
||||||
|
if(user == "" || pass == ""){
|
||||||
|
//Go to login page
|
||||||
|
window.location = '/login'
|
||||||
|
}
|
||||||
|
|
||||||
utils.ajax.login(user, pass);
|
utils.ajax.login(user, pass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue