Sencha Touch 2.4.2 Login Page

Ext.define('My.view.Login', {
extend: 'Ext.form.Panel',
xtype: "login",
id: "login",

requires: [
'Ext.Container',
'Ext.form.*'
],

config: {
controller: 'login',
bodyPadding: 10,
title: 'Login Window',
closable: false,
autoShow: true,
fullscreen: true,
layout: "card",
activeItem: 0,
ui: 'light',
cls: "loginView",
items: [{
xtype: 'fieldset',
title: 'Login Info',
instructions: 'Please enter your user name and password',
defaults: {
required: true
},
items: [{
xtype: 'textfield',
name: 'name',
itemId: 'username',
placeHolder: 'User Name',
autoCapitalize: false
}, {
xtype: 'passwordfield',
name: 'password',
itemId: 'password',
placeHolder: 'Password'
}, {
xtype: 'button',
text: 'Login',
itemId: 'loginbutton',
style: 'margin-left: 2%;margin-right: 2%;margin-top: 5%;',
handler: function() {
var frmLogin = Ext.getCmp('login');
frmLogin.submit({
url: 'https://server:port/login.php',
waitMsg: 'Submitting your credentials',
success: function(form, action) {
if (action && action.result)
Ext.Viewport.add(Ext.create('My.view.Main'));
},
failure: function(form, action) {
Ext.Msg.alert('Error', "Login is failed");
}
})
}

}, ]
}]
}

});

Advertisements