jgrenon / angular-desktop-app

This is a simple application skeleton to create desktop application using AngularJS. This application is using node-webkit as our desktop host, bower to install client-side libraries as well as normal npm modules as supported by node-webkit.
MIT License
237 stars 57 forks source link

securityService injected in home controller, but missing. #2

Closed talss89 closed 10 years ago

talss89 commented 10 years ago

The title says it all really.

Rather than remove the dependency on securityService, I think it would make sense to provide a skeleton securityService instance. One that simply returns authorised and "Guest" as username.

It seems to me that securityService is a useful design pattern to keep as a template.

I'm using this code currently:

define(['./module'], function (services) {
    'use strict';

    services.service('securityService', ['$q', function($q)  {

        this.hasValidToken = function() {

           return $q.when(true);
        };

        this.getUserInfos = function() {
            return $q.when({name: "Guest"});
        };

    }]);
});
talss89 commented 10 years ago

The home view attempts to display $scope.username on the footer navbar.

My code above will return an object, and the home controller is storing the return value of securityService.getUserInfos() in $scope.user

I've updated the view on my fork so we're displaying $scope.user.name

jgrenon commented 10 years ago

Yes, I removed it before publishing the project. My plan was to make a new version of the whole thing, but didn't have the time. Can you create a pull request with your code? I'll add it to the project as the default SecurityService.

talss89 commented 10 years ago

Cool, I'll do this now.

I'll include the minor change to views/home.jade in the pull request too.