Implement user authorization

This commit is contained in:
Eike Foken
2011-04-21 23:43:13 +02:00
parent bc67619ce2
commit 111799073b
10 changed files with 1326 additions and 44 deletions

View File

@@ -1,48 +1,64 @@
<?php $this->load->view('header'); ?>
<!DOCTYPE html>
<html lang="de">
<head>
<title>Scattport</title>
<meta charset="utf-8" />
<?=link_tag('assets/css/main.css');?>
<?=link_tag('assets/js/ext/resources/css/ext-all.css');?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<!-- ExtJS library: base/adapter -->
<?=script_tag('assets/js/ext/adapter/jquery/ext-jquery-adapter.js');?>
<!-- ExtJS library: all widgets -->
<?=script_tag('assets/js/ext/ext-all.js');?>
<script type="text/javascript">
var BASE_URL = '<?=site_url('/');?>';
var BASE_PATH = '<?=base_url();?>';
</script>
<?=script_tag('assets/js/common.js');?>
</head>
<body>
<script type="text/javascript">
var message = function(title, message) {
Ext.Msg.show({
title: title,
msg: message,
minWidth: 200,
modal: true,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
});
};
var loginForm = new Ext.form.FormPanel({
frame: true,
border: false,
width: 340,
labelWidth: 120,
defaults: {
width: 180
},
url: BASE_URL + 'auth/do_login',
method: 'POST',
items: [
new Ext.form.TextField({
id: "username",
id: 'username',
fieldLabel: "Benutzername",
allowBlank: false,
blankText: "Benutzernamen eingeben"
}),
new Ext.form.TextField({
id:"password",
id: 'password',
fieldLabel: "Passwort",
inputType: 'password',
allowBlank: false,
blankText: "Passwort eingeben"
})
}),
<?php if ($this->config->item('remember_users', 'auth')): ?>
new Ext.form.Checkbox({
id: 'remember',
height: 20,
boxLabel: "Eingeloggt bleiben"
}),
<?php endif; ?>
],
buttons: [{
text: "Login",
handler: function() {
if (loginForm.getForm().isValid()) {
loginForm.getForm().submit({
url: BASE_URL + 'auth/do_login',
waitMsg: "Lade...",
success: function(loginForm) {
message("Erfolg", "Willkommen zurück");
success: function() {
window.location = BASE_URL;
},
failure: function(result, response) {
message("Fehler", response.result.message);
}
});
}
@@ -58,7 +74,7 @@ var loginForm = new Ext.form.FormPanel({
var loginWindow = new Ext.Window({
title: "Willkommen zu scattport",
layout: 'fit',
height: 140,
height: 200,
width: 340,
closable: false,
resizable: false,
@@ -69,4 +85,5 @@ var loginWindow = new Ext.Window({
loginWindow.show();
</script>
<?php $this->load->view('footer'); ?>
</body>
</html>