diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-02-12 15:05:00 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-02-12 15:05:00 +1300 |
commit | 84d88b46f9b768063410ca88ce0be78842f5f355 (patch) | |
tree | f84cb44eb450d06fa4cf47e5ea645cd54e503b9d /web/Login.js | |
parent | 596536b7a9efd22e8843f6cc5aeab91d39472441 (diff) | |
download | trackermap-server-84d88b46f9b768063410ca88ce0be78842f5f355.tar.gz trackermap-server-84d88b46f9b768063410ca88ce0be78842f5f355.tar.bz2 trackermap-server-84d88b46f9b768063410ca88ce0be78842f5f355.zip |
Implement login user flow
Diffstat (limited to 'web/Login.js')
-rw-r--r-- | web/Login.js | 30 |
1 files changed, 25 insertions, 5 deletions
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' }] }); |