aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Application.js4
-rw-r--r--web/app/view/LoginController.js20
2 files changed, 12 insertions, 12 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 34d65d13a..5cc192686 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -79,7 +79,9 @@ Ext.define('Traccar.Application', {
},
showError: function (response) {
- if (response.statusText) {
+ if (Ext.isString(response)) {
+ Ext.Msg.alert(Strings.errorTitle, response);
+ } else if (response.statusText) {
Ext.Msg.alert(Strings.errorTitle, response.statusText);
} else {
Ext.Msg.alert(Strings.errorTitle, Strings.errorConnection);
diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js
index 0b2090ffb..0ac8408fa 100644
--- a/web/app/view/LoginController.js
+++ b/web/app/view/LoginController.js
@@ -34,19 +34,16 @@ Ext.define('Traccar.view.LoginController', {
Ext.getBody().mask(Strings.sharedLoading);
Ext.Ajax.request({
scope: this,
- url: '/api/login',
+ method: 'POST',
+ url: '/api/rest/session',
params: form.getValues(),
callback: function (options, success, response) {
- var result;
Ext.getBody().unmask();
- if (Traccar.ErrorManager.check(success, response)) {
- result = Ext.decode(response.responseText);
- if (result.success) {
- Traccar.app.setUser(result.data);
- this.fireViewEvent('login');
- } else {
- Traccar.ErrorManager.error(Strings.loginFailed);
- }
+ if (success) {
+ Traccar.app.setUser(Ext.decode(response.responseText));
+ this.fireViewEvent('login');
+ } else {
+ Traccar.app.showError(Strings.loginFailed);
}
}
});
@@ -56,7 +53,8 @@ Ext.define('Traccar.view.LoginController', {
logout: function () {
Ext.Ajax.request({
scope: this,
- url: '/api/logout',
+ method: 'DELETE',
+ url: '/api/rest/session',
callback: function () {
window.location.reload();
}