<div class="container">
<div class="row nd_hero-row">
<div class="span8 offset2">
[% IF params.login_failed %]
<div class="alert alert-error fade in">
<a class="close" data-dismiss="alert">×</a>
Incorrect username or password, please try again.
</div>
[% END %]
[% IF params.logout %]
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
You are now logged out.
</div>
[% END %]
[% IF params.nosuchdevice %]
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
Sorry, no such device is known.
</div>
[% END %]
[% IF vars.notfound %]
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
Sorry, page not found.
</div>
[% END %]
[% IF settings.suggest_guest AND NOT session.logged_in_user %]
<div class="alert alert-info fade in">
<a class="close" data-dismiss="alert">×</a>
Guest access is available by entering username "guest" and password "guest".
</div>
[% END %]
<div class="hero-unit">
<h2>Welcome to Netdisco</h2>
<small>Netdisco is an Open Source management tool designed for network administrators.</small>
[% IF NOT session.logged_in_user %]
<form class="nd_login-form" method="post" action="[% uri_for('/login') %]">
<div class="form-horizontal">
<input id='loginuser' placeholder="Username" class="span2" name="username" type="text" required="required"/>
<input placeholder="Password" class="span2" name="password" type="password" required="required"/>
<button type="submit" class="btn btn-info">Log In</button>
[% IF settings.login_logo %]
<img src="[% settings.login_logo %]" alt="Login Logo" />
[% END %]
</div>
[% IF params.return_url %]
<input type="hidden" name="return_url" value="[% params.return_url | html_entity %]"/>
[% END %]
</form>
[% ELSE %]
[% IF user_has_role('admin') %]
<form class="nd_login-form" method="post" action="[% uri_for('/admin/discover') %]">
<div class="form-horizontal">
<input placeholder="Device hostname or IP" class="span4" name="device" value="[% params.device %]" type="text"/>
<input type="hidden" name="extra" value="with-nodes"/>
<button type="submit" class="btn btn-info">Discover</button>
</div>
</form>
[% END %]
[% END %]
</div>
</div>
</div>
[% IF session.logged_in_user %]
<div class="accordion" id="accordion-statistics">
<div class="accordion-group">
<div class="accordion-heading nd_sysinfo-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-stats" href="#">
<i class="icon-chevron-up nd_chevron"></i> System Information
</a>
</div>
<div id="collapse-stats" class="accordion-body collapse">
<div class="accordion-inner">
<div id="nd_stats">
<div id="nd_stats_status" class="span2 offset4 alert">
<i class="icon-spinner icon-spin"></i> Compiling statistics...</div>
</div>
</div>
</div>
</div>
</div>
[% END %]
</div> <!-- /container -->
[% IF session.logged_in_user %]
<script type="text/javascript">
var stats_loaded = 0;
$('#nq').focus(); // set focus to navbar search
$('#loginuser').focus(); // set focus to login, if it's there
$('.collapse').on('show', function() {
$('.nd_chevron').toggleClass('icon-chevron-up icon-chevron-down');
if (! stats_loaded) {
$('#nd_stats').load("[% uri_for('/ajax/content/statistics') %]", function(r,s,x) {
if (s == "error") {
$('#nd_stats_status').addClass('alert-error')
.html('<i class="icon-warning-sign"></i> Failed to retrieve system information.');
}
});
stats_loaded = 1;
}
});
$('.collapse').on('hide', function() {
$('.nd_chevron').toggleClass('icon-chevron-up icon-chevron-down');
});
</script>
[% END %]