aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-02-12 15:05:00 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-02-12 15:05:00 +1300
commit84d88b46f9b768063410ca88ce0be78842f5f355 (patch)
treef84cb44eb450d06fa4cf47e5ea645cd54e503b9d /web
parent596536b7a9efd22e8843f6cc5aeab91d39472441 (diff)
downloadtrackermap-server-84d88b46f9b768063410ca88ce0be78842f5f355.tar.gz
trackermap-server-84d88b46f9b768063410ca88ce0be78842f5f355.tar.bz2
trackermap-server-84d88b46f9b768063410ca88ce0be78842f5f355.zip
Implement login user flow
Diffstat (limited to 'web')
-rw-r--r--web/Application.js6
-rw-r--r--web/Login.js30
-rw-r--r--web/Strings.js1
3 files changed, 28 insertions, 9 deletions
diff --git a/web/Application.js b/web/Application.js
index a1794770a..2cd8df2a0 100644
--- a/web/Application.js
+++ b/web/Application.js
@@ -19,12 +19,10 @@ Ext.application({
requires: [
'Strings',
'Styles',
- 'Login',
- 'MainView'
+ 'Login'
],
launch: function() {
- //Ext.create('Login').show();
- Ext.create('MainView', { renderTo: document.body });
+ Ext.create('Login').show();
}
});
diff --git a/web/Login.js b/web/Login.js
index 6c42d7ddb..bdae5723d 100644
--- a/web/Login.js
+++ b/web/Login.js
@@ -23,10 +23,12 @@ Ext.define('LoginForm', {
defaults: { anchor: '100%' },
+ url: '/api/login',
+
items: [{
allowBlank: false,
fieldLabel: Strings.login_user,
- name: 'user'
+ name: 'name'
}, {
allowBlank: false,
fieldLabel: Strings.login_password,
@@ -34,16 +36,34 @@ Ext.define('LoginForm', {
inputType: 'password'
}],
- buttons: [
- { text: Strings.login_register },
- { text: Strings.login_login }
- ]
+ buttons: [{
+ text: Strings.login_register
+ }, {
+ text: Strings.login_login,
+ handler: function() {
+ var win = this.up('window');
+ var form = this.up('form').getForm();
+ if (form.isValid()) {
+ form.submit({
+ success: function(form, action) {
+ win.close();
+ Ext.create('MainView', { renderTo: document.body });
+ },
+ failure: function(form, action) {
+ Ext.Msg.alert(Strings.login_title, Strings.login_failed);
+ }
+ });
+ }
+ }
+ }]
});
Ext.define('Login', {
extend: 'Ext.window.Window',
+ requires: [ 'MainView' ],
title: Strings.login_title,
+ closable: false,
items: [{ xtype: 'login-form' }]
});
diff --git a/web/Strings.js b/web/Strings.js
index 5d310fb4c..6d210f75b 100644
--- a/web/Strings.js
+++ b/web/Strings.js
@@ -22,6 +22,7 @@ Ext.define('Strings', {
login_password: 'Password',
login_register: 'Register',
login_login: 'Login',
+ login_failed: 'Incorrect user name or password.',
device_title: 'Devices',