mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
added cancel button to login window
This commit is contained in:
@@ -71,6 +71,27 @@ function clearState(){
|
|||||||
Ext.getCmp('navigationPanel').removeAll();
|
Ext.getCmp('navigationPanel').removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkLogin(){
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: restUrl + 'authentication.json',
|
||||||
|
method: 'GET',
|
||||||
|
success: function(response){
|
||||||
|
if ( debug ){
|
||||||
|
console.debug('login success');
|
||||||
|
}
|
||||||
|
var s = Ext.decode(response.responseText);
|
||||||
|
loadState(s);
|
||||||
|
},
|
||||||
|
failure: function(){
|
||||||
|
if ( debug ){
|
||||||
|
console.debug('login failed');
|
||||||
|
}
|
||||||
|
var loginWin = new Sonia.login.Window();
|
||||||
|
loginWin.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function login(){
|
function login(){
|
||||||
clearState();
|
clearState();
|
||||||
var loginWin = new Sonia.login.Window();
|
var loginWin = new Sonia.login.Window();
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
buttons:[{
|
buttons:[{
|
||||||
|
text: 'Cancel',
|
||||||
|
scope: this,
|
||||||
|
handler: this.cancel
|
||||||
|
},{
|
||||||
text: 'Login',
|
text: 'Login',
|
||||||
formBind: true,
|
formBind: true,
|
||||||
scope: this,
|
scope: this,
|
||||||
@@ -78,10 +82,17 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.addEvents('cancel');
|
||||||
|
|
||||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||||
Sonia.login.Form.superclass.initComponent.apply(this, arguments);
|
Sonia.login.Form.superclass.initComponent.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cancel: function(){
|
||||||
|
this.fireEvent('cancel');
|
||||||
|
checkLogin();
|
||||||
|
},
|
||||||
|
|
||||||
authenticate: function(){
|
authenticate: function(){
|
||||||
var form = this.getForm();
|
var form = this.getForm();
|
||||||
form.submit({
|
form.submit({
|
||||||
@@ -127,6 +138,9 @@ Sonia.login.Window = Ext.extend(Ext.Window,{
|
|||||||
this.fireEvent('success');
|
this.fireEvent('success');
|
||||||
this.close();
|
this.close();
|
||||||
}, this);
|
}, this);
|
||||||
|
form.on('cancel', function(){
|
||||||
|
this.close();
|
||||||
|
}, this);
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
layout:'fit',
|
layout:'fit',
|
||||||
|
|||||||
@@ -70,25 +70,7 @@ Ext.onReady(function(){
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
// check login
|
checkLogin();
|
||||||
Ext.Ajax.request({
|
|
||||||
url: restUrl + 'authentication.json',
|
|
||||||
method: 'GET',
|
|
||||||
success: function(response){
|
|
||||||
if ( debug ){
|
|
||||||
console.debug('login success');
|
|
||||||
}
|
|
||||||
var s = Ext.decode(response.responseText);
|
|
||||||
loadState(s);
|
|
||||||
},
|
|
||||||
failure: function(){
|
|
||||||
if ( debug ){
|
|
||||||
console.debug('login failed');
|
|
||||||
}
|
|
||||||
var loginWin = new Sonia.login.Window();
|
|
||||||
loginWin.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// adds a tab to main TabPanel
|
// adds a tab to main TabPanel
|
||||||
function addTabPanel(id, xtype, title){
|
function addTabPanel(id, xtype, title){
|
||||||
|
|||||||
Reference in New Issue
Block a user