Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Павел Резуненко
/
MTAweb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7d59ca13
authored
Mar 27, 2013
by
Павел Резуненко
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Доработка окна авторизации
1 parent
1b4cf51f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
2 deletions
public/app/controller/Viewport.js
public/app/view/Authorize.js
public/app/controller/Viewport.js
View file @
7d59ca1
...
...
@@ -14,6 +14,12 @@ Ext.define('MyMA.controller.Viewport', {
},
{
selector
:
'authorize > form'
,
ref
:
'authForm'
},
{
selector
:
'authorize > form #authorize'
,
ref
:
'authButton'
},
{
selector
:
'authorize > form #autherrormsg'
,
ref
:
'authErrorMsg'
}],
/**
...
...
@@ -45,6 +51,13 @@ Ext.define('MyMA.controller.Viewport', {
this
.
control
({
'authorize > form > toolbar > button'
:
{
click
:
this
.
Authorize
},
'authorize > form field'
:
{
specialkey
:
function
(
field
,
e
)
{
if
(
e
.
getKey
()
==
e
.
ENTER
)
{
this
.
Authorize
();
}
}
}
});
...
...
@@ -61,12 +74,14 @@ Ext.define('MyMA.controller.Viewport', {
if
(
this
.
getAuthPanel
())
{
var
form
=
this
.
getAuthPanel
().
down
(
'form'
).
getForm
();
if
(
form
.
isValid
())
{
this
.
getAuthButton
().
setIconCls
(
'x-ibtn-loading x-ibtn-def'
);
form
.
submit
({
url
:
Ext
.
Ajax
.
getRestUrl
(
'api'
,
'login'
,
'authorize'
,
0
),
method
:
'PUT'
,
clientValidation
:
true
,
scope
:
this
,
success
:
this
.
successLogin
success
:
this
.
successLogin
,
failure
:
this
.
failLogin
})
}
}
...
...
@@ -119,6 +134,50 @@ Ext.define('MyMA.controller.Viewport', {
},
/**
* If login failed this function will show debug message if
* debug mode is on
*/
failLogin
:
function
(
form
,
action
)
{
try
{
this
.
getAuthButton
().
setIconCls
(
''
);
var
data
=
Ext
.
decode
(
action
.
response
.
responseText
);
if
(
data
.
error
.
trace
)
{
Ext
.
Msg
.
showError
({
msg
:
data
});
}
else
{
var
msg
=
this
.
getAuthErrorMsg
();
msg
.
tpl
.
overwrite
(
msg
.
getEl
(),
{
message
:
data
.
error
.
message
||
data
.
error
.
title
});
if
(
msg
&&
!
msg
.
isVisible
())
{
msg
.
show
();
}
msg
.
stopAnimation
();
msg
.
animate
({
duration
:
5
,
to
:
{
opacity
:
1
}
});
msg
.
animate
({
duration
:
5000
,
to
:
{
opacity
:
0
}
});
}
}
catch
(
e
)
{
}
},
/**
* Logout
* public
...
...
public/app/view/Authorize.js
View file @
7d59ca1
...
...
@@ -24,11 +24,35 @@ Ext.define('MyMA.view.Authorize', {
monitorValid
:
true
,
frame
:
false
,
border
:
false
,
bodyStyle
:
{
border
:
0
,
background
:
'transparent'
},
defaults
:
{
anchor
:
'100%'
},
tbar
:
{
border
:
false
,
height
:
20
,
style
:
{
border
:
0
,
background
:
'transparent'
,
padding
:
0
},
items
:
{
xtype
:
'container'
,
itemId
:
'autherrormsg'
,
hidden
:
true
,
style
:
{
color
:
'red'
},
tpl
:
'{message}'
,
data
:
{
message
:
''
}
}
},
buttons
:
[{
text
:
'Login'
text
:
'Login'
,
itemId
:
'authorize'
}],
items
:
[{
fieldLabel
:
'Login'
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment