diff --git a/config.js b/config.js
index 0622890..a286816 100644
--- a/config.js
+++ b/config.js
@@ -42,7 +42,8 @@ angular.module('flashy', [
if (rejection.status == 403) {
console.log(rejection);
if (rejection.data && rejection.data.detail == 'Please verify your email before continuing') {
- $rootScope.$broadcast('account_locked');
+ UserService.showLockedMessage();
+ UserService.logout();
}
}
return $q.reject(rejection);
@@ -53,10 +54,9 @@ angular.module('flashy', [
$urlRouterProvider.otherwise('/404');
var auth_resolve = {
authorize: function($q, $state, $stateParams, UserService) {
- if (UserService.noAuthRequired($state)) {
- console.log('no auth state ' + $state.name);
- return $state.go(state.name);
- }
+ if (UserService.noAuthRequired($state)) {
+ return console.log('no auth state ' + $state.name);
+ }
console.log('resolving user before continuing for ' + $state.name);
var redirectAsNeeded = function() {
if (!UserService.isLoggedIn()) {
@@ -65,7 +65,7 @@ angular.module('flashy', [
$state.go('login');
}
if (!UserService.authorizedFor($state, $stateParams)) {
- console.log('user not authorized for ' + $state.name);
+ console.log('user not authorized for ' + $state.name);
$state.go('addclass');
}
};
diff --git a/home.html b/home.html
index 45f176f..936a903 100644
--- a/home.html
+++ b/home.html
@@ -27,24 +27,25 @@
Add Class
-
+
-
Flashy
diff --git a/scripts/FeedController.js b/scripts/FeedController.js
index fab4ccd..db63ebf 100644
--- a/scripts/FeedController.js
+++ b/scripts/FeedController.js
@@ -118,7 +118,7 @@ angular.module('flashy.FeedController', ['ui.router', 'ngAnimate']).
console.log(card);
return -1;
};
-
+
$scope.update = function(id, new_score) {
card = $scope.cardTable[id].obj;
if (Math.abs(new_score - card.score) < .0001) {
@@ -130,7 +130,7 @@ angular.module('flashy.FeedController', ['ui.router', 'ngAnimate']).
var column = $scope.cardCols[$scope.cardTable[id].colNum];
var found = column.indexOf(card);
var i = 0;
- for (; i < column.length; i++)
+ for (; i < column.length; i++)
if (column[i].score <= new_score) break;
card.score = new_score;
if ($scope.$$phase) { // most of the time it is "$digest"
diff --git a/scripts/RootController.js b/scripts/RootController.js
index d306f07..2f159a3 100644
--- a/scripts/RootController.js
+++ b/scripts/RootController.js
@@ -57,15 +57,6 @@ angular.module('flashy.RootController', ['ui.router', 'ngResource']).
ws.onclose = function(e) {
console.log('connection closed');
};
- $rootScope.$on('account_locked', function() {
- UserService.logout();
- if ($rootScope.locked_toast_active) return;
- $rootScope.locked_toast_active = true;
- Materialize.toast('Thanks for trying Flashy! To ensure quality content, we ask that you verify your email before continuing', 4000, '', function() {
- $rootScope.locked_toast_active = undefined;
- });
- $state.go('login');
- });
$rootScope.$on('server_error', function(error) {
Materialize.toast('A server error occurred! Proceed with caution', 4000);
diff --git a/scripts/UserService.js b/scripts/UserService.js
index 3a87b66..4dfb4f6 100644
--- a/scripts/UserService.js
+++ b/scripts/UserService.js
@@ -3,12 +3,16 @@ angular.module('flashy.UserService', ['ui.router']).
var deferred = $q.defer();
var _user = false;
var login = function(data) {
- _user = data;
+ if (data.locked) {
+ $rootScope.UserService.showLockedMessage();
+ return deferred.reject('account locked');
+ }
if (!data.is_confirmed) {
Materialize.toast('Please verify your email address! ' +
- '' +
+ '' +
'Resend Verification Email', 4000);
}
+ _user = data;
_user.sectionIdList = _user.sections.map(function(x) {
return x.id;
});
@@ -66,14 +70,18 @@ angular.module('flashy.UserService', ['ui.router']).
}
return true;
};
- this.noAuthRequired = function(state) {
- if (['verifyemail'].indexOf(state.name) >= 0) {
- return true;
- }
- return false;
- };
+ this.showLockedMessage = function(){
+ Materialize.toast('You must verify your email address before continuing.' +
+ '' +
+ 'Resend Verification Email', 4000);
+ }
+ this.noAuthRequired = function(state) {
+ if (['verifyemail'].indexOf(state.name) >= 0) {
+ return true;
+ }
+ return false;
+ };
this.resendConfirmationEmail = function() {
- if (!this.isLoggedIn()) return console.log("Can't request resending a confirmation email since the user is not logged in.");
console.log('Requesting resend of confirmation email');
$http.post('/api/resend_confirmation_email/').success(function() {
Materialize.toast('Resent confirmation email! Check your spam folder too.', 4000);
diff --git a/styles/flashy.css b/styles/flashy.css
index 0d324fe..ed8e13a 100644
--- a/styles/flashy.css
+++ b/styles/flashy.css
@@ -373,14 +373,6 @@ md-content.md-default-theme {
opacity: 0;
}
-/*.repeated-card.ng-move + div div {*/
-/*background-color:blue;*/
-/*top: -150px;*/
-/*}*/
-
-/*.repeated-card.ng-move.ng-move-active + div div{*/
-/*top: 0;*/
-}
/* Animation CSS END */
diff --git a/templates/settings.html b/templates/settings.html
index afd9b8b..0da0de2 100644
--- a/templates/settings.html
+++ b/templates/settings.html
@@ -1,38 +1,39 @@