Skip to content

Commit

Permalink
Merge pull request techx#44 from xTEddie/fix-routes
Browse files Browse the repository at this point in the history
Prevent users to fill out confirmation form without being admitted
  • Loading branch information
jlin816 authored Nov 8, 2017
2 parents 31cbf37 + f21e459 commit e279373
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/client/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ angular.module('reg')
url: "/confirmation",
templateUrl: "views/confirmation/confirmation.html",
controller: 'ConfirmationCtrl',
data: {
requireCompletedProfile: true
},
resolve: {
currentUser: function(UserService){
return UserService.getCurrentUser();
Expand Down Expand Up @@ -183,6 +186,7 @@ angular.module('reg')
var requireLogin = toState.data.requireLogin;
var requireAdmin = toState.data.requireAdmin;
var requireVerified = toState.data.requireVerified;
var requireCompletedProfile = toState.data.requireCompletedProfile;

if (requireLogin && !Session.getToken()) {
event.preventDefault();
Expand All @@ -199,6 +203,11 @@ angular.module('reg')
$state.go('app.dashboard');
}

if (requireCompletedProfile && !Session.getUser().completedProfile) {
event.preventDefault();
$state.go('app.dashboard');
}

});

}]);

0 comments on commit e279373

Please sign in to comment.