mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 14:26:51 +00:00
added user logout menu
This commit is contained in:
parent
bd3971e23d
commit
ca837e5f02
@ -1,8 +1,15 @@
|
||||
<!-- we can include some common header page stuff in here, i.e. menus, nav tabs etc. -->
|
||||
<img src="image/logo.jpg" alt="mifosX"/>
|
||||
<nav>
|
||||
<a href="#/">Start page</a>
|
||||
<a href="#/home">Home page</a>
|
||||
<a href="#/login">Login page</a>
|
||||
</nav>
|
||||
<div>
|
||||
<div class="menu-links">
|
||||
<nav>
|
||||
<a href="#/">Start page</a>
|
||||
<a href="#/home">Home page</a>
|
||||
<a href="#/login">Login page</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="menu-user" data-ng-hide="currentUser == null">
|
||||
<div>User: <strong>{{currentUser.name}}</strong> <a data-ng-click="logout()">(Logout)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
if (!test) {
|
||||
angular.bootstrap(document, ["MifosX_Application"]);
|
||||
}
|
||||
// require([], 'test/test_realtime_demo');
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
(function(module) {
|
||||
mifosX.models = _.extend(module, {
|
||||
User: function(data) {
|
||||
this.name = data.username;
|
||||
|
||||
this.getHomePageIdentifier = function() {
|
||||
var role = _.first(data.selectedRoles || data.roles);
|
||||
return mifosX.models.roleMap[role.id];
|
||||
|
||||
@ -10,3 +10,15 @@ nav a:hover {
|
||||
nav a:active {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.menu-links {
|
||||
float: left;
|
||||
}
|
||||
.menu-user {
|
||||
margin-right: 20px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.menu-user a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
describe("AuthenticationService", function() {
|
||||
var scope, http, callbacks;
|
||||
var scope, httpService, callbacks;
|
||||
beforeEach(function() {
|
||||
callbacks = {};
|
||||
scope = jasmine.createSpyObj("$rootScope", ['$broadcast']);
|
||||
|
||||
http = jasmine.createSpyObj("$http", ['post', 'success', 'error']);
|
||||
http.post.andReturn(http);
|
||||
httpService = jasmine.createSpyObj("httpService", ['post', 'success', 'error']);
|
||||
httpService.post.andReturn(httpService);
|
||||
_.each(['success', 'error'], function(method) {
|
||||
http[method].andCallFake(function(callback) {
|
||||
httpService[method].andCallFake(function(callback) {
|
||||
callbacks[method] = callback;
|
||||
return this;
|
||||
});
|
||||
});
|
||||
|
||||
new mifosX.services.AuthenticationService(scope, http).authenticateWithUsernamePassword({
|
||||
new mifosX.services.AuthenticationService(scope, httpService).authenticateWithUsernamePassword({
|
||||
username: "test_username",
|
||||
password: "test_password",
|
||||
});
|
||||
});
|
||||
|
||||
it("should pass the correct parameters to the post method", function() {
|
||||
expect(http.post).toHaveBeenCalledWith("/authentication?username=test_username&password=test_password");
|
||||
expect(httpService.post).toHaveBeenCalledWith("/authentication?username=test_username&password=test_password");
|
||||
});
|
||||
|
||||
describe("On successful authentication", function() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user