aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-02 12:06:00 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-02 12:06:00 +1300
commita0c9cec5beb28448073b127c31df23134336f4cf (patch)
treec52c396dbfaf4b10084677af1720908efc00c7cb /web/app/view
parenta0a96b253b90d389a5c06ba1133b2a2f32ecb0fc (diff)
downloadtrackermap-server-a0c9cec5beb28448073b127c31df23134336f4cf.tar.gz
trackermap-server-a0c9cec5beb28448073b127c31df23134336f4cf.tar.bz2
trackermap-server-a0c9cec5beb28448073b127c31df23134336f4cf.zip
Implement REST login in the web app
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/LoginController.js20
1 files changed, 9 insertions, 11 deletions
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();
}