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();
|
||||
}
|
||||
|
||||
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(){
|
||||
clearState();
|
||||
var loginWin = new Sonia.login.Window();
|
||||
|
||||
@@ -71,6 +71,10 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
|
||||
}
|
||||
}],
|
||||
buttons:[{
|
||||
text: 'Cancel',
|
||||
scope: this,
|
||||
handler: this.cancel
|
||||
},{
|
||||
text: 'Login',
|
||||
formBind: true,
|
||||
scope: this,
|
||||
@@ -78,10 +82,17 @@ Sonia.login.Form = Ext.extend(Ext.FormPanel,{
|
||||
}]
|
||||
};
|
||||
|
||||
this.addEvents('cancel');
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.login.Form.superclass.initComponent.apply(this, arguments);
|
||||
},
|
||||
|
||||
cancel: function(){
|
||||
this.fireEvent('cancel');
|
||||
checkLogin();
|
||||
},
|
||||
|
||||
authenticate: function(){
|
||||
var form = this.getForm();
|
||||
form.submit({
|
||||
@@ -127,6 +138,9 @@ Sonia.login.Window = Ext.extend(Ext.Window,{
|
||||
this.fireEvent('success');
|
||||
this.close();
|
||||
}, this);
|
||||
form.on('cancel', function(){
|
||||
this.close();
|
||||
}, this);
|
||||
|
||||
var config = {
|
||||
layout:'fit',
|
||||
|
||||
@@ -70,25 +70,7 @@ Ext.onReady(function(){
|
||||
]
|
||||
});
|
||||
|
||||
// check login
|
||||
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();
|
||||
}
|
||||
});
|
||||
checkLogin();
|
||||
|
||||
// adds a tab to main TabPanel
|
||||
function addTabPanel(id, xtype, title){
|
||||
|
||||
Reference in New Issue
Block a user