From 7bc8852043b8962903e591547c684ac1929a4ef7 Mon Sep 17 00:00:00 2001 From: Josef Citrine Date: Tue, 17 May 2016 12:59:46 +0100 Subject: [PATCH] Check if logged before checking admin --- resources/assets/scripts/app/services/auth.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/scripts/app/services/auth.coffee b/resources/assets/scripts/app/services/auth.coffee index 783c8415..e35c615d 100644 --- a/resources/assets/scripts/app/services/auth.coffee +++ b/resources/assets/scripts/app/services/auth.coffee @@ -17,7 +17,7 @@ module.exports = angular.module('ponyfm').factory('auth', [ '$rootScope' ($rootScope) -> - data: {isLogged: window.pfm.auth.isLogged, user: window.pfm.auth.user, isAdmin: (window.pfm.auth.user.roles[0] && window.pfm.auth.user.roles[0].id == 2)} + data: {isLogged: window.pfm.auth.isLogged, user: window.pfm.auth.user, isAdmin: (window.pfm.auth.isLogged && window.pfm.auth.user.roles[0] && window.pfm.auth.user.roles[0].id == 2)} login: (email, password, remember) -> def = new $.Deferred() $.post('/api/web/auth/login', {email: email, password: password, remember: remember})