Commit 03587815 by Johannes Edmeier

Add login-ui-module

This new ui-module provides a login page and a logout button. closes #361
parent 38a5cb25
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<module>spring-boot-admin-server-ui-activiti</module> <module>spring-boot-admin-server-ui-activiti</module>
<module>spring-boot-admin-server-ui-hystrix</module> <module>spring-boot-admin-server-ui-hystrix</module>
<module>spring-boot-admin-server-ui-turbine</module> <module>spring-boot-admin-server-ui-turbine</module>
<module>spring-boot-admin-server-ui-login</module>
<module>spring-boot-admin-samples</module> <module>spring-boot-admin-samples</module>
<module>spring-boot-admin-starter-client</module> <module>spring-boot-admin-starter-client</module>
<module>spring-boot-admin-docs</module> <module>spring-boot-admin-docs</module>
...@@ -244,6 +245,11 @@ ...@@ -244,6 +245,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui-login</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId> <artifactId>spring-boot-admin-starter-client</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
......
...@@ -96,3 +96,19 @@ The Activiti module shows information from the `/activti` endpoint. ...@@ -96,3 +96,19 @@ The Activiti module shows information from the `/activti` endpoint.
---- ----
spring.boot.admin.routes.endpoints: env,metrics,trace,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,activiti spring.boot.admin.routes.endpoints: env,metrics,trace,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,activiti
---- ----
==== Login UI Module ====
The Login module just provides you a login page and a logout button.
. Add the ui module to your classpath:
+
[source,xml,subs="verbatim,attributes"]
.pom.xml
----
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui-login</artifactId>
<version>{project-version}</version>
</dependency>
----
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin</artifactId>
<version>1.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>spring-boot-admin-server-ui-login</artifactId>
</project>
.form-login {
max-width: 300px;
padding: 19px 29px 29px;
margin: 0 auto 20px;
background-color: #fff;
border: 1px solid #e5e5e5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.form-login .form-login-heading,
.form-login .checkbox {
margin-bottom: 10px;
}
.form-login input[type="text"],
.form-login input[type="password"] {
height: auto;
margin-bottom: 15px;
padding: 7px 9px;
}
.error-message {
display: none;
}
.error .error-message {
display: initial;
}
\ No newline at end of file
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Spring Boot Admin</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.png" />
<link rel="stylesheet" type="text/css" href="core.css" />
<link rel="stylesheet" type="text/css" href="login.css" />
</head>
<body>
<header class="navbar header--navbar desktop-only">
<div class="navbar-inner">
<div class="container-fluid">
<div class="spring-logo--container">
<a class="spring-logo" href="#"><span></span></a>
</div>
<div class="spring-logo--container">
<a class="spring-boot-logo" href="#"><span></span></a>
</div>
</div>
</div>
</header>
<div class="container">
<form class="form-login" action="/login" method="post">
<h2 class="form-login-heading">Login</h2>
<div id="login-controls" class="control-group">
<input type="text" class="input-block-level" name="username" placeholder="Username">
<input type="password" class="input-block-level" name="password" placeholder="Password">
<span class="help-inline error-message">Invalid username or password!</div>
<input type="submit" class="btn btn-success" value="Login"></input>
</div>
</form>
</div>
<script type="text/javascript">
if (/\?error/.test(window.location.href)) {
document.getElementById("login-controls").classList.add("error")
}
</script>
<footer class="footer">
<ul class="inline">
<li><a href="https://codecentric.github.io/spring-boot-admin/@project.version@" target="_blank">Reference Guide</a></li>
<li>-</li>
<li><a href="https://github.com/codecentric/spring-boot-admin" target="_blank">Sources</a></li>
<li>-</li>
<li>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License 2.0</a></li>
</ul>
</footer>
</body>
</html>
\ No newline at end of file
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function (sbaModules, angular) {
'use strict';
var module = angular.module('sba-login', ['sba-core']);
sbaModules.push(module.name);
module.controller('logoutCtrl', ['$scope', '$document', function () {
angular.element('#logout-form').submit();
}]);
module.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('logout', {
template: '<form id="logout-form" action="/logout" method="post"></form>',
name: 'logout',
url: '/logout',
controller: 'logoutCtrl'
});
}]);
module.run(['MainViews', '$sce', function (MainViews, $sce) {
MainViews.register({
title: $sce.trustAsHtml('<i class="fa fa-2x fa-sign-out" aria-hidden="true"></i>'),
state: 'logout',
order: 9999
});
}]);
} (sbaModules, angular));
...@@ -74,8 +74,8 @@ pre { ...@@ -74,8 +74,8 @@ pre {
text-transform: uppercase; text-transform: uppercase;
text-shadow: none; text-shadow: none;
font-size: 14px; font-size: 14px;
line-height: 14px; line-height: 70px;
padding: 28px 20px; padding: 0 20px;
transition: all 0.15s; transition: all 0.15s;
-webkit-transition: all 0.15s; -webkit-transition: all 0.15s;
-moz-transition: all 0.15s; -moz-transition: all 0.15s;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</div> </div>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li ng-repeat="view in mainViews" class="navbar-link" ng-class="{active: $state.includes(view.state)}"> <li ng-repeat="view in mainViews" class="navbar-link" ng-class="{active: $state.includes(view.state)}">
<a ui-sref="{{view.state}}" ng-bind="view.title"></a> <a ui-sref="{{view.state}}" ng-bind-html="view.title"></a>
</li> </li>
</ul> </ul>
...@@ -49,15 +49,15 @@ ...@@ -49,15 +49,15 @@
<script type="text/javascript"> <script type="text/javascript">
sbaModules = []; sbaModules = [];
</script> </script>
<script src="core.js" type="text/javascript"></script> <script src="core.js" type="text/javascript"></script>
<script src="all-modules.js" type="text/javascript"></script> <script src="all-modules.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
angular.element(document).ready(function() { angular.element(document).ready(function () {
angular.bootstrap(document, sbaModules.slice(0), { angular.bootstrap(document, sbaModules.slice(0), {
strictDi: true strictDi: true
}); });
}); });
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment