diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json index f04b5ce31b..4f6da3c1d1 100644 --- a/client/src/i18n/en.json +++ b/client/src/i18n/en.json @@ -19,11 +19,11 @@ "CREATE" : "Create Chart of Accounts", "GENERATE" : "Generate Account Report", "HELP_TXT_1" : "Chart of accounts for", - "HELP_TXT_2" : "Account information and relationshions are shown in the table on the right", + "HELP_TXT_2" : "Account information and relationships are shown in the table on the right", "HELP_TXT_3" : "Click 'Add Account' to add an account", "NEW" : "New Account", - "NOT_FOUND" : "Aucun compte enregistrés...", - "TITLE" : "Account Managment", + "NOT_FOUND" : "Not accounts found.", + "TITLE" : "Account Management", "TITLE_ACCOUNT" : "Title Account" }, "AUTH": { @@ -33,9 +33,9 @@ "LOGIN" : "Login", "LOGIN_PLACEHOLDER_PASSWORD" : "Enter your password", "LOGIN_PLACEHOLDER_USERNAME" : "Enter your username", - "LOGOUT_SUCCESS" : "You are now logged out.", - "RESET" : "Reset", - "TOO_MANY_TRYS" : "Forgot your username or password? Please ask the system administrator to reset it." + "TOO_MANY_TRYS" : "Forgot your username or password? Please ask the system administrator to reset it.", + "WELCOME" : "Welcome to bhima!", + "GOODBYE" : "Thank you for using bhima. Come back soon!" }, "BILLING_SERVICES": { "BTN": { @@ -107,7 +107,7 @@ "BACK" : "Back to Debtor Groups", "CREATE" : "Create Debtor Group", "CREATE_ANOTHER" : "Create another Debtor Group", - "CREATED" : "Debtor group recorded successfully", + "CREATED" : "Debtor group recorded successfully", "EDIT" : "Edit Debtor Group", "GROUPS" : "Debtor Groups", "HELP_TXT_1" : "This interface allows you to review, find, and configure debtor groups", @@ -134,7 +134,7 @@ "INFO" : "With this configuration option checked all members of this debtor group will be exempt from paying automatically applied billing services", "LABEL" : "This group is exempt from paying billing services" } - }, + }, "TITLE" : "Debtor Group Management", "SUBSCRIBED" : "Debtors subscribed", "UPDATED" : "Debtor group record updated" @@ -181,7 +181,8 @@ "ERRORS": { "ERR_INTERNET_DISCONNECTED" : "You are not connected to the network.", "NO_EXCHANGE_RATE" : "No Exchange rate defined", - "UNAUTHORIZED" : "Unauthorized" + "UNAUTHORIZED" : "You have submitted a bad username and password combination. Please login in with valid credentials to continue.", + "ERR_INTERNET_DISCONNECTED" : "You are not connected to the network." }, "EXCHANGE": { "ADDING_RATE" : "Adding an exchange Rate", @@ -227,15 +228,15 @@ "CONFIRM_DELETE" : "Do you confirm the deletion ?" }, "ERRORS": { - "CONNECTION" : "Connexion error", + "CONNECTION" : "Connection error", "GENERIC" : "The form contains errors.", "HAS_ERROR" : "Contains an error", "HAS_ERRORS" : "The form contains errors. Please correct them and resubmit.", "MIN_CURRENCY_UNIT" : "This value is too small for the selected currency.", - "MISSING" : "Missing information", + "MISSING" : "This form is missing required fields (marked in red).", "MISSING_CASHBOX_ID" : "Missing Cashbox", "MISSING_DEBTOR_ID" : "Identifying missing Debtor", - "RECORD_ERROR" : "Please resolve any errors on the form. (Marked in red)", + "RECORD_ERROR" : "Please resolve any errors on the form (marked in red).", "REQUIRED" : "This value is required." }, "INFOS": { @@ -248,7 +249,6 @@ "GROUPS_PATIENT" : "Assign the patient to patient groups from the options below. Press 'confirm' to permenantly update the patient's subscribed groups.", "ITEMS_FULL" : "There are no additional inventory items that be assigned to this invoice.", "LOADING" : "Loading", - "MANY_TRYS" : "Many trys", "NOT_CONFIGURED" : "The accounts for this currency have not been configured yet.", "NO_INVOICES_SELECTED" : "No invoices selected", "NO_RECIPIENT" : "An invoice must have a recipient before assigning items.", @@ -257,7 +257,6 @@ "PATIENT_FOUND" : "Patient Found", "PATIENT_NOT_FOUND" : "Patient Not Found", "SAVE_SUCCESS" : "Save success", - "UNAUTHORIZED" : "Unauthorized", "UPDATE_SUCCESS" : "Updated successfully" }, "LABELS": { @@ -566,14 +565,14 @@ "VIEW_PATIENT_RECORDS" : "View Patient Records" }, "PATIENT_REGISTRY" : { - "DAY" : "day", + "DAY" : "day", "DAYS" : "days", "MONTH" : "month", "MONTHS" : "months", "YEAR_OLD" : "year old", - "YEARS_OLD" : "years old", + "YEARS_OLD" : "years old", "TITLE" : "Patients Registry" - }, + }, "PERMISSIONS": { "ADDING_USER" : "Add a user", "ADD_USER" : "Add a New User", @@ -721,7 +720,7 @@ "EXCHANGE_RATE" : "Exchange Rate", "FILTERING": { "LABEL" : "Filter" - }, + }, "FIRST_NAME" : "First Name", "FUNCTION" : "Function", "GENDER" : "Gender", @@ -734,7 +733,7 @@ "IS_WAREHOUSE" : "Is Warehouse ?", "LABEL" : "Label", "LAST_NAME" : "Last Name", - "LAST_TRANSACTION" : "Last Transactions", + "LAST_TRANSACTION" : "Last Transactions", "LAST_VISIT" : "Last Visit", "LISTS" : "Registered price list", "LOADING" : "Fetching data from the server.", diff --git a/client/src/i18n/fr.json b/client/src/i18n/fr.json index 7c73aecaae..e81a1c6ddd 100644 --- a/client/src/i18n/fr.json +++ b/client/src/i18n/fr.json @@ -32,9 +32,9 @@ "LOGIN" : "Se connecter", "LOGIN_PLACEHOLDER_PASSWORD" : "Entrez votre mot de passe", "LOGIN_PLACEHOLDER_USERNAME" : "Entrez votre nom d'utilisateur", - "LOGOUT_SUCCESS" : "Vous n'etes pas connecté", - "RESET" : "Annuler", - "TOO_MANY_TRYS" : "Si vous avez oublié votre login ou votre mot de passe? S'il vous plaît demander à l'administrateur du système pour le réinitialiser." + "TOO_MANY_TRYS" : "Avez-vous oublié votre login ou votre mot de passe? S'il vous plaît demander à l'administrateur du système pour le réinitialiser.", + "WELCOME" : "Bienvenue à bhima!", + "GOODBYE" : "Merci d'utiliser bhima! Reviennez bientôt!" }, "BILLING_SERVICES": { "BTN": { @@ -180,7 +180,7 @@ "ERRORS": { "ERR_INTERNET_DISCONNECTED" : "Vous n'êtes pas connecté à un réseau.", "NO_EXCHANGE_RATE" : "Aucun taux de change defini", - "UNAUTHORIZED" : "Non autorisé" + "UNAUTHORIZED" : "Vous avez soumis une mauvais nom et mot de passe. Entrez un nom et mot de passe valid pour continuer." }, "EXCHANGE": { "ADDING_RATE" : "Ajout d'un taux", @@ -675,7 +675,7 @@ }, "SETTINGS": { "TITLE" : "Paramètres" - }, + }, "SUBSIDY": { "ADDING_SUBSIDY" : "Ajout d'une subvention", "ADD_SUBSIDY" : "Ajouter subvention", @@ -944,4 +944,4 @@ "TITLE" : "Bordereau de transfert" } } -} \ No newline at end of file +} diff --git a/client/src/js/services/NotifyService.js b/client/src/js/services/NotifyService.js index 000dd20dd9..0c1fbf112e 100644 --- a/client/src/js/services/NotifyService.js +++ b/client/src/js/services/NotifyService.js @@ -54,6 +54,7 @@ function NotifyService($translate) { service.danger = danger; service.info = info; service.warn = warn; + service.fatal = fatal; service.handleError = handleError; @@ -76,6 +77,11 @@ function NotifyService($translate) { setNotification(key, ttl, formatOptions.warn); } + // this should only be used in rare circumstances, such as the login page + function fatal(key, ttl) { + setNotification(key, ttl, formatOptions.error); + } + /** * This method is not simply a formatting alias - it accepts an error object * and parses it to show relevent information in the notification. @@ -90,7 +96,7 @@ function NotifyService($translate) { var message = $translate.instant(key); // if the request has overridden the time to live, use that, otherwise use the global default - var ttl = ttl || TTL; + ttl = ttl || TTL; var formatNotification = { ttl : ttl, message : message diff --git a/client/src/js/services/session.js b/client/src/js/services/session.js index 5d9a33749d..bda318fef8 100644 --- a/client/src/js/services/session.js +++ b/client/src/js/services/session.js @@ -2,7 +2,7 @@ angular.module('bhima.services') .service('SessionService', SessionService); SessionService.$inject = [ - '$sessionStorage', '$http', '$location', 'util', '$rootScope' + '$sessionStorage', '$http', '$location', 'util', '$rootScope', 'NotifyService' ]; /** @@ -19,7 +19,7 @@ SessionService.$inject = [ * @module services/SessionService.js * @constructor */ -function SessionService($sessionStorage, $http, $location, util, $rootScope) { +function SessionService($sessionStorage, $http, $location, util, $rootScope, Notify) { var service = this; // set up the storage instance @@ -83,6 +83,9 @@ function SessionService($sessionStorage, $http, $location, util, $rootScope) { // notify login event $rootScope.$emit('login'); + // display welcome message + Notify.info('AUTH.WELCOME', 5000); + return session; }); } @@ -104,6 +107,9 @@ function SessionService($sessionStorage, $http, $location, util, $rootScope) { // navigate to the main page $location.url('/login'); + + // bid the user farewell + Notify.info('AUTH.GOODBYE', 5000); }); } diff --git a/client/src/partials/login/login.html b/client/src/partials/login/login.html index 817ec4c05a..b6e9e30425 100644 --- a/client/src/partials/login/login.html +++ b/client/src/partials/login/login.html @@ -4,11 +4,6 @@
-

- - {{ "AUTH.TOO_MANY_TRYS" | translate }} -

-
@@ -95,30 +90,19 @@
-
+
- +

{{ "FORM.ERRORS.MISSING" | translate }}

- - -

- - {{ LoginCtrl.error.code | translate }} -

- -

- - {{ "FORM.INFOS.MANY_TRYS" | translate }} -

diff --git a/client/src/partials/login/login.js b/client/src/partials/login/login.js index 015a98a8b6..4c661082f4 100644 --- a/client/src/partials/login/login.js +++ b/client/src/partials/login/login.js @@ -2,7 +2,8 @@ angular.module('bhima.controllers') .controller('LoginController', LoginController); LoginController.$inject = [ - 'appcache', 'SessionService', 'LanguageService', 'ProjectService' + 'appcache', 'SessionService', 'LanguageService', 'ProjectService', + 'NotifyService' ]; /** @@ -10,7 +11,7 @@ LoginController.$inject = [ * * The login controller powers the bhima login page. */ -function LoginController(AppCache, Session, Languages, Projects) { +function LoginController(AppCache, Session, Languages, Projects, Notify) { var vm = this; // the is the same as the SettingsContoller @@ -18,8 +19,8 @@ function LoginController(AppCache, Session, Languages, Projects) { // tracks the number of login attempts made by this user to show a // "forgot password" message if too many requests are made - var loginAttempts = 0; - var maxLoginAttempts = 3; + var attempts = 0; + var maxAttempts = 3; // contains the values from the login form vm.credentials = {}; @@ -63,9 +64,6 @@ function LoginController(AppCache, Session, Languages, Projects) { // logs the user in, creates the user client session function login(form) { - // clear previous HTTP errors if they exist - delete vm.error; - // if the form is not valid, do not generate an $http request if (form.$invalid) { return; } @@ -76,12 +74,14 @@ function LoginController(AppCache, Session, Languages, Projects) { }) .catch(function (response) { - // bind the $http error to the view - vm.error = response.data; + // if the user has tried too many times, display a fatal error working for + // ten seconds. + if (maxAttempts <= attempts++) { + return Notify.fatal('AUTH.TOO_MANY_TRYS', 10000); + } - // augment the count and rebind the excessive attempts variable - loginAttempts++; - vm.excessiveAttempts = (maxLoginAttempts <= loginAttempts); + // use growl-notifications to display an error at the top of the window + Notify.danger(response.data.code); }); } }