Commit 91a87295 authored by Antek Grzanka's avatar Antek Grzanka

UI for login.

parent 73cd8d5a
......@@ -15,10 +15,10 @@
<span class="title"></span>
</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="page#/home">Początek</a></li>
<li><a href="page#/tasks">Zadania</a></li>
<li><a href="page#/scores">Wyniki</a></li>
<li ng-if="logged" ng-click="logout()">Wyloguj {{user}}</li>
<li ng-if="logged"><a href="page#/home">Początek</a></li>
<li ng-if="logged"><a href="page#/tasks">Zadania</a></li>
<li ng-if="logged"><a href="page#/scores">Wyniki</a></li>
<li ng-if="logged" ng-click="logout()"><a href="page#/">Wyloguj</a></li>
</ul>
</div>
</nav>
......@@ -52,13 +52,7 @@
<script>
$(function(){
$(".title").typed({
strings: ["<b>capture the flag</b>", "<b>capture the flAGH 2016</b>"],
startDelay: 10,
backDelay: 500
});
});
......
......@@ -10,6 +10,7 @@
AuthenticationService.login($scope.username, $scope.password, function(response) {
if(response.status == 200) {
AuthenticationService.setCredentials($scope.username, $scope.password, response.team);
$('.title').html($scope.username+'@<b>capture-the-flAGH-2016</b>');
$location.path('/');
} else {
$scope.error = response.message;
......
......@@ -9,6 +9,7 @@
$scope.logout = function(){
AuthenticationService.logout(function(data){
console.log("Logged you out... i guess...", data);
$('.title').html('guest@<b>capture-the-flAGH-2016</b>');
$location.path('/');
});
};
......
......@@ -45,9 +45,19 @@
app.run(['$rootScope', '$location', '$cookieStore', '$http',
function ($rootScope, $location, $cookieStore, $http) {
// keep user logged in after page refresh
$rootScope.globals = $cookieStore.get('globals') || {};
var username = $rootScope.globals.currentUser ? $rootScope.globals.currentUser.username : 'guest';
$(".title").typed({
strings: [username+"@<b>capture-the-flag</b>", username+"@<b>capture-the-flAGH-2016</b>"],
startDelay: 10,
backDelay: 500,
whenToStop: 14 + username.length
});
if ($rootScope.globals.currentUser) {
$http.defaults.headers.common['Authorization'] = 'Not-So-Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line
}
......
......@@ -93,6 +93,8 @@
// the order of strings
this.sequence = [];
this.whenToStop = this.options.whenToStop || 14;
// All systems go!
this.build();
};
......@@ -249,7 +251,9 @@
// humanized value for typing
}, humanize);
}
},
whenToStop: 14
,
backspace: function(curString, curStrPos) {
......@@ -272,7 +276,7 @@
// the stopNum actually represents the amount of chars to
// keep in the current string. In my case it's 14.
if (self.arrayPos == 0){
self.stopNum = 14;
self.stopNum = self.whenToStop;
}
//every other time, delete the whole typed string
else {
......
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