add login and register views

This commit is contained in:
Stefan Sterz 2016-02-23 17:47:31 +01:00
parent 14343e7fdd
commit 11ec0315b9
1 changed files with 68 additions and 3 deletions

View File

@ -15,17 +15,25 @@
</head>
<body ng-app="autome">
<div class="container">
<div class="row">
<div class="twelve columns">
<nav ng-controller="NavCtrl">
<a href="/#/home"><h4>Trev</h4></a>
<ul>
<li ng-hide="isLoggedIn()"><a href="/#/login">Log in</a></li>
<li ng-show="isLoggedIn()"><a href="/#/register">Add user</a></li>
<li ng-show="isLoggedIn()"><a href="/#/login" ng-click="logOut()">Log out</a></li>
<li ng-show="isLoggedIn()" class="user" >{{ currentUser() }}</li>
</ul>
</nav>
<ui-view></ui-view>
</div>
</div>
</div>
<script type="text/ng-template" id="/home.html">
<div class="header">
<h1>Autome</h1>
<script type="text/ng-template" id="/home.html">
<table class="u-full-width">
<thead>
<th>RC Switches</th>
@ -44,7 +52,64 @@
<form ng-submit="irTest()" style="margin-top:30px;">
<button type="submit" class="button-primary">IR</button>
</form>
</script>
<script type="text/ng-template" id="/register.html">
<div ng-show="error">
<span class="errorm">{{ error.message }}</span>
</div>
<form ng-submit="register()"
style="margin-top:30px;">
<h3>Register</h3>
<div class="row">
<div class="six columns">
<label>Username</label>
<input type="text"
class="u-full-width"
placeholder="Username"
ng-model="user.username"></input>
</div>
<div class="six columns">
<label>Password</label>
<input type="password"
class="u-full-width"
placeholder="Password"
ng-model="user.password"></input>
</div>
</div>
<button type="submit" class="button-primary">Register</button>
</form>
</script>
<script type="text/ng-template" id="/login.html">
<div ng-show="error">
<span class="errorm">{{ error.message }}</span>
</div>
<form ng-submit="logIn()"
style="margin-top:30px;">
<h3>Log in</h3>
<div class="row">
<div class="six columns">
<label>Username</label>
<input type="text"
class="u-full-width"
placeholder="Username"
ng-model="user.username"></input>
</div>
<div class="six columns">
<label>Password</label>
<input type="password"
class="u-full-width"
placeholder="Password"
ng-model="user.password"></input>
</div>
</div>
<button type="submit" class="button-primary">Log in</button>
</form>
</script>
</body>