MIFOSX-1139 Add connection failed message

This commit is contained in:
Alex Ivanov 2015-01-17 18:56:41 +02:00
parent 6c20db3827
commit 16c81d959c
6 changed files with 26 additions and 20 deletions

View File

@ -206,13 +206,14 @@
"label.outstanding.amount":"Loan outstanding amount",
"label.and": "and",
"label.message.password.expired":"Your password is expired, please reset your password",
"label.today": "Today",
"label.today": "Today",
"label.relDate": "Mifos X Release Date: ",
"label.relVersion": "Release Version: ",
"#Enumeration & Error Messages": "..",
"label.error": "Error",
"error.login.failed": "Please try again, your credentials are not valid",
"error.login.failed": "Please try again, your credentials are not valid.",
"error.connection.failed": "Couldn't connect to server. Make sure you are using correct settings.",
"error.msg.command.unsupported": "Programmer error: The `command` issued is not supported.",
"error.msg.query.parameter.value.unsupported": "`{{params[1].value}}` is not supported as a value of query parameter `{{params[0].value}}`.",
"error.msg.not.authorized": "Insufficient privileges to perform this action.",
@ -412,7 +413,7 @@
"label.anchor.advsearch":"Advance search",
"label.anchor.collectionsheet":"Collection sheet",
"label.anchor.save":"Save",
"#Inputs": "..",
"label.input.searchbyuser": "Search by user",
"label.input.searchactivities": "Search activities",
@ -698,7 +699,7 @@
"label.heading.managegroups":"Manage Groups",
"label.heading.associatenewgroups": "Associate New Groups",
"label.heading.centermembers": "Center Members (Groups)",
"#Anchors": "..",
"label.anchor.centers": "Centers",
"label.anchor.viewcenter": "View Center",
@ -873,7 +874,7 @@
"label.input.financial.activity.type":"Financial activity",
"label.input.date.of.opening.balances":"Date of opening balances",
"label.input.opening.balances.contra.account":"Opening balances contra",
"#journalEntryType code ": ".............",
"journalEntryType.credit": "Credit",
"journalEntrytType.debit": "Debit",

View File

@ -5,16 +5,16 @@
<link rel="icon" type="image/png" href="./images/favicon.ico" />
<title>{{ 'label.heading.mifosxclient' | translate }}</title>
<style>[data-ng-cloak] { display: none !important; }</style>
</head>
<body class="preview whitebg" id="top" data-spy="scroll" data-target=".subnav" data-offset="80" data-ng-controller="MainController">
<!--Loader -->
<!--Loader -->
<div id="loaderWrapper" data-ng-hide="domReady" style="position: absolute; height: 100%; width: 100%; top: 0;">
<div id="loader" style="margin: 175px auto">
<img src="./images/MifosX_logo.png" alt="MifosX" style="min-width: 50px; width: 6%; margin: 0 auto" class="img-responsive">
<img src="./images/loader.gif" style="margin: 10px auto" class="img-responsive">
</div>
</div>
</div>
<div data-ng-hide="!domReady" data-ng-cloak>
<!-- Login Form -->
@ -37,7 +37,7 @@
<br/><br/>
<div ng-hide="resetPassword">
<form class="form-inline pull-right" role="form">
<label class="error" data-ng-show="authenticationFailed"><strong>{{ 'error.login.failed' | translate }}</strong></label>
<label class="error" data-ng-show="authenticationFailed"><strong>{{ authenticationErrorMessage | translate }}</strong></label>
<div class="form-group">
<input ng-autofocus="true" type="text" data-ng-model="loginCredentials.username" placeholder="{{ 'label.input.username' | translate }}" class="input-sm form-control" required id="uid">
</div>
@ -69,7 +69,7 @@
<span>{{ 'label.heading.version' | translate }} 1.26.0</span>
<br /> <span>{{ 'label.heading.uptodate' | translate }}</span>
<br /> <span ng-bind-html="text"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
@ -109,7 +109,7 @@
</div>
</div>
</div>
</div>
</div>
<!-- Navbar -->
@ -160,8 +160,8 @@
<li class="divider"></li>
<li><a class="black" href="#/createcenter"><i class="icon-map-marker icon-large"></i> + {{ 'label.anchor.center' | translate}}</a></li>
<li class="divider"></li>
<li><a class="black" ng-click= "helpf()" ><i class="icon-question-sign icon-large"></i>&nbsp;&nbsp;&nbsp;{{ 'label.anchor.help' | translate }}</a></li>
<li><a class="black" ng-click= "helpf()" ><i class="icon-question-sign icon-large"></i>&nbsp;&nbsp;&nbsp;{{ 'label.anchor.help' | translate }}</a></li>
</ul>
</div>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
@ -226,7 +226,7 @@
</div>
<!-- Footer -->
<footer>
<p align="center"> <a href="https://mifosforge.jira.com/browse/MIFOSX/component/11710/?selectedTab=com.atlassian.jira.jira-projects-plugin:component-changelog-panel" target="_blank"> {{'label.relVersion' | translate}} {{version}} | {{'label.relDate' | translate}} {{releasedate}} </a> </p>
<p align="center"> <a href="https://mifosforge.jira.com/browse/MIFOSX/component/11710/?selectedTab=com.atlassian.jira.jira-projects-plugin:component-changelog-panel" target="_blank"> {{'label.relVersion' | translate}} {{version}} | {{'label.relDate' | translate}} {{releasedate}} </a> </p>
</footer>
<hr>
</div> <!-- /row-fluid -->

View File

@ -10,9 +10,14 @@
// delete scope.loginCredentials.password;
};
scope.$on("UserAuthenticationFailureEvent", function (event, data) {
scope.$on("UserAuthenticationFailureEvent", function (event, data, status) {
delete scope.loginCredentials.password;
scope.authenticationFailed = true;
if(status != 401) {
scope.authenticationErrorMessage = 'error.connection.failed';
} else {
scope.authenticationErrorMessage = 'error.login.failed';
}
});
scope.$on("UserAuthenticationSuccessEvent", function (event, data) {

View File

@ -6,8 +6,8 @@
localStorageService.addToLocalStorage('userData', data);
};
var onFailure = function (data) {
scope.$broadcast("UserAuthenticationFailureEvent", data);
var onFailure = function (data, status) {
scope.$broadcast("UserAuthenticationFailureEvent", data, status);
};
var apiVer = '/mifosng-provider/api/v1';

View File

@ -8,7 +8,7 @@
<button id="loginButton" data-ng-click="login()">{{'label.button.login' | translate}}</button>
</div>
<div data-ng-show="authenticationFailed">
<p>{{'error.login.failed' | translate}}</p>
<p>{{authenticationErrorMessage | translate}}</p>
</div>
</div>

View File

@ -38,9 +38,9 @@ describe("AuthenticationService", function () {
describe("On failed authentication", function () {
it("should broadcast a 'UserAuthenticationFailureEvent' on failed authentication", function () {
callbacks['error']("test_data");
callbacks['error']("test_data", "status_code");
expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationFailureEvent", "test_data");
expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationFailureEvent", "test_data", "status_code");
});
});
});