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

UI for login.

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