我正在尝试使用 Sencha Touch 2 构建一个多登录系统,用户是否必须选择他是代理还是追随者。到目前为止,我已经能够想出一个简单的登录表单。没有功能。我的代码是这样的:
Ext.define("ikhlas.view.login", {
extend: 'Ext.Panel',
xtype: 'loginpanel',
config:{
title: 'Login',
iconCls: 'more',
styleHtmlContent: true,
layout:{
type: 'vbox',
},
items: [
{
xtype: 'fieldset',
iconCls: 'add',
items: [
{
xtype: 'emailfield',
name: 'email',
placeHolder: 'Username'
},
{
xtype: 'passwordfield',
name: 'password',
placeHolder: 'Password'
},
{
xtype: 'selectfield',
label: 'User Type',
options: [
{text: 'Agent', value: '0'},
{text: 'Follower', value: '1'}
]
}
]},
{
xtype: 'button',
text: 'LogIn',
ui: 'confirm',
width: '40%',
height: '7%',
flex: 1,
left: '55%',
action: 'submitContact'
},
{
xtype: 'button',
text: 'Forgot Username',
ui: 'confirm',
width: '41%',
height: '4%',
top: '90%',
flex: 1,
action: 'ForgotUsername'
},
{
xtype: 'button',
text: 'Forgot Password',
ui: 'confirm',
width: '40%',
height: '4%',
top: '90%',
flex: 1,
left: '47%',
action: 'ForgotPassword'
},
]}
});
现在我想知道如何从 API 验证用户信息(用户名和密码)(将给出一个 url),以便在允许他们访问应用程序之前确认登录用户名和密码是正确的。其次,如果用户名或密码不正确,我想抛出一条错误消息。