Restructure the login page

This commit is contained in:
Johannes Zellner
2015-08-10 13:56:52 +02:00
parent 1025249e93
commit 2c2471811d
3 changed files with 60 additions and 25 deletions
+34 -24
View File
@@ -1,32 +1,40 @@
<% include header %>
<center>
<h1>Login to <%= applicationName %></h1>
</center>
<% if (error) { %>
<center>
<br/><br/>
<h4 class="has-error"><%= error %></h4>
</center>
<% } %>
<div class="container">
<div class="container main-container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<form id="loginForm" action="" method="post">
<input type="hidden" name="_csrf" value="<%= csrf %>"/>
<div class="form-group">
<label class="control-label" for="inputUsername">Username or Email</label>
<input type="text" class="form-control" id="inputUsername" name="username" autofocus required>
<div class="col-md-4 col-md-offset-4">
<div class="card" style="max-width: none; padding: 20px; text-align: left;">
<div class="row">
<div class="col-md-12">
<h1>Login to <%= applicationName %></h1>
</div>
</div>
<div class="form-group">
<label class="control-label" for="inputPassword">Password</label>
<input type="password" class="form-control" name="password" id="inputPassword" required>
<br/>
<% if (error) { %>
<div class="row">
<div class="col-md-12">
<h4 class="has-error"><%= error %></h4>
</div>
</div>
<input class="btn btn-primary btn-outline pull-right" type="submit" value="Sign in"/>
</form>
<a href="/api/v1/session/password/resetRequest.html">Reset your password</a>
<% } %>
<div class="row">
<div class="col-md-12">
<form id="loginForm" action="" method="post">
<input type="hidden" name="_csrf" value="<%= csrf %>"/>
<div class="form-group">
<label class="control-label" for="inputUsername">Username or Email</label>
<input type="text" class="form-control" id="inputUsername" name="username" autofocus required>
</div>
<div class="form-group">
<label class="control-label" for="inputPassword">Password</label>
<input type="password" class="form-control" name="password" id="inputPassword" required>
</div>
<input class="btn btn-primary btn-outline pull-right" type="submit" value="Sign in"/>
</form>
<a href="/api/v1/session/password/resetRequest.html">Reset your password</a>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -34,6 +42,8 @@
<script>
(function () {
'use strict';
var search = window.location.search.slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
document.getElementById('loginForm').action = '/api/v1/session/login?returnTo=' + search.returnTo;