forked from angular-app/angular-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a box to show the current user and a logout button.
- Loading branch information
1 parent
4ded5a9
commit 628c826
Showing
4 changed files
with
36 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
angular.module('signin', ['services.authentication','services.users']).controller('SignInCtrl', ['$scope', 'AuthenticationService', function ($scope, AuthenticationService) { | ||
angular.module('signin', ['services.authentication', 'services.users']).controller('SignInCtrl', ['$scope', 'AuthenticationService', function($scope, AuthenticationService) { | ||
|
||
$scope.user = {}; | ||
$scope.authError = false; | ||
$scope.authService = AuthenticationService; | ||
|
||
$scope.clearForm = function () { | ||
$scope.clearForm = function() { | ||
$scope.user = {}; | ||
}; | ||
|
||
// Get the current user when the controller is instantiated - this could be put in the main app controller so that it is only called once?? | ||
AuthenticationService.requestCurrentUser(); | ||
|
||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,8 +211,8 @@ describe('services.authentication', function() { | |
var userInfo = { email: '[email protected]', firstName: 'Jo', lastName: 'Bloggs'}; | ||
$httpBackend.expect('GET', '/current-user'); | ||
$httpBackend.when('GET', '/current-user').respond(userInfo); | ||
service.requestCurrentUser().success(function(response) { | ||
expect(response).toBe(userInfo); | ||
service.requestCurrentUser().then(function(response) { | ||
expect(service.currentUser).toBe(userInfo); | ||
}); | ||
$httpBackend.flush(); | ||
}); | ||
|