inrichten base applicatie

This commit is contained in:
2017-12-15 19:17:56 +01:00
parent ab143a51b9
commit 7f2314c00b
9 changed files with 93 additions and 39 deletions
+1
View File
@@ -30,3 +30,4 @@ user_guide_src/cilexer/pycilexer.egg-info/*
/tests/tests/
/tests/results/
/resources
/.env
+1 -1
View File
@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array();
$autoload['libraries'] = array('database', 'session');
/*
| -------------------------------------------------------------------
+8 -2
View File
@@ -19,12 +19,18 @@ class MY_Controller extends CI_Controller {
private function handle()
{
$this->environment();
}
function clean_input( $post )
{
return str_replace( 'null', '', $this->db->escape_str( $this->input->post( $post ), TRUE ) );
$value = $this->input->post( $post );
// $escapedValue = $this->db->escape_string( $value, TRUE );
$denulledValue = str_replace( 'null', '', $value);
return $denulledValue;
}
public function json($data)
+14 -7
View File
@@ -34,25 +34,28 @@
</head>
<body class="animsition page-login-v3 layout-full">
<!-- Page -->
<div class="page vertical-align text-center" data-animsition-in="fade-in" data-animsition-out="fade-out">>
<?php $this->load->view('specials/notifyme_modal'); ?>
<div class="page vertical-align text-center" data-animsition-in="fade-in" data-animsition-out="fade-out">
<div class="page-content vertical-align-middle animation-slide-top animation-duration-1">
<div class="panel">
<div class="panel" id="login-form">
<div class="panel-body">
<div class="brand">
<img class="brand-img" src="css/images/logo_dbo.png" alt="...">
<h2 class="brand-text font-size-18">projectbeheer</h2>
</div>
<form method="post" action="#">
<div>
<div class="form-group form-material floating" data-plugin="formMaterial">
<input type="text" class="form-control" name="email" />
<input type="text" class="form-control" name="email"
data-bind="textInput:username" />
<label class="floating-label">gebruikersnaam</label>
</div>
<div class="form-group form-material floating" data-plugin="formMaterial">
<input type="password" class="form-control" name="password" />
<input type="password" class="form-control" name="password"
data-bind="textInput:password" />
<label class="floating-label">wachtwoord</label>
</div>
<button type="submit" class="btn btn-primary btn-block btn-lg mt-40">Log in</button>
</form>
<button type="button" class="btn btn-primary btn-block btn-lg mt-40" data-bind="click:login">Log in</button>
</div>
</div>
</div>
@@ -102,5 +105,9 @@
<script src="js/vendor/Plugin/switchery.js"></script>
<script src="js/vendor/Plugin/jquery-placeholder.js"></script>
<script src="js/vendor/Plugin/material.js"></script>
<script src="js/vendor/Knockout.min.js"></script>
<script src="js/lib/modules/login/loginModule.js"></script>
<script src="js/lib/modules/specials/notifyModule.js"></script>
</body>
</html>
@@ -0,0 +1,27 @@
<div class="modal" tabindex="-1" role="dialog" id="notify-me">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" data-bind="text:title"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p data-bind="text:message"></p>
</div>
<div class="modal-footer">
<!-- ko if : notify() -->
<button type="button" class="btn btn-primary"
data-bind="text:yesText; click:closeYes"></button>
<button type="button" class="btn btn-secondary" data-dismiss="modal"
data-bind="text:noText; click:closeNo"></button>
<!-- /ko -->
<!-- ko if : ! notify() -->
<button type="button" class="btn btn-secondary" data-dismiss="modal"
data-bind="click:closeOk">OK</button>
<!-- /ko -->
</div>
</div>
</div>
</div>
+2 -1
View File
@@ -11,7 +11,8 @@
"source": "https://github.com/bcit-ci/CodeIgniter"
},
"require": {
"php": ">=5.3.7"
"php": ">=5.3.7",
"vlucas/phpdotenv": "^2.4"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
+14
View File
@@ -1,4 +1,18 @@
<?php
/**
* Load all enviroment variables
*
* using: vlucas/phpdotenv (composer require vlucas/phpdotenv)
*/
include_once('../vendor/autoload.php');
//$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv = new Dotenv\Dotenv('../');
$dotenv->load();
/**
* CodeIgniter
*
+16 -17
View File
@@ -4,42 +4,42 @@
* Date: 05/12/2017
* Time: 11:17
*/
var pp = {};
var dbo = {};
$( function () {
pp.loginModel = {
dbo.loginModel = {
username: ko.observable( '' ),
password: ko.observable( '' ),
login: function () {
pp.loginService.login();
dbo.loginService.login();
}
}
ko.applyBindings( pp.loginModel, document.getElementById( "login-user" ) );
console.log( 'text' );
ko.applyBindings( dbo.loginModel, document.getElementById( "login-form" ) );
} );
pp.loginService = {
dbo.loginService = {
login: function () {
var ds = pp.loginDataservice;
var self = pp.loginService;
var vm = pp.loginModel;
var ds = dbo.loginDataservice;
var self = dbo.loginService;
var vm = dbo.loginModel;
self.validateInput( function ( data ) {
if ( !data ) return self.notifyWrongPassword();
self.validateInput( function ( submitDATA ) {
if ( ! submitDATA ) return self.notifyWrongPassword();
ds.login( submitDATA, function ( data ) {
if ( data ) return location.reload();
// if ( data ) return location.reload();
} );
} );
},
validateInput: function ( callback ) {
var vm = pp.loginModel;
var vm = dbo.loginModel;
if ( vm.username().length < 2 ) return callback( false );
if ( vm.password().length < 6 ) return callback( false );
@@ -55,14 +55,13 @@ pp.loginService = {
notifyWrongPassword: function () {
notifyMe( {
title : 'Login fout',
message: 'Gebruikersnaam / wachtwoord komen niet overeen',
alert : true
message: 'Gebruikersnaam / wachtwoord komen niet overeen'
} );
}
};
pp.loginDataservice = {
dbo.loginDataservice = {
login: function ( submitDATA, callback ) {
$.post( 'index.php/login/', submitDATA, function ( data ) {
+10 -11
View File
@@ -6,10 +6,10 @@
*/
var notifyMe = function ( options, callback ) {
pp.notifyModel.init( options, callback );
dbo.notifyModel.init( options, callback );
}
pp.notifyModel = {
dbo.notifyModel = {
title : ko.observable( null ),
message : ko.observable( null ),
@@ -21,7 +21,7 @@ pp.notifyModel = {
callback : null,
init: function ( options, callback ) {
var vm = pp.notifyModel;
var vm = dbo.notifyModel;
vm.callback = callback;
@@ -31,36 +31,35 @@ pp.notifyModel = {
},
setOptions: function ( options ) {
var vm = pp.notifyModel;
var vm = dbo.notifyModel;
vm.title( options.title || '' );
vm.message( options.message || '' );
vm.notify( options.notify || false );
vm.alert( options.alert || false );
vm.notify( options.notify || true );
vm.noText( options.noText || 'Nee' );
vm.yesText( options.yesText || 'Ja' );
vm.closeText( options.closeText || 'ok' );
},
closeNo: function () {
if ( typeof( pp.notifyModel.callback ) == 'function' ) callback( false );
if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback( false );
},
closeYes: function () {
if ( typeof( pp.notifyModel.callback ) == 'function' ) callback( true );
if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback( true );
},
closeOk: function () {
if ( typeof( pp.notifyModel.callback ) == 'function' ) callback();
if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback();
},
close: function () {
if ( typeof( pp.notifyModel.callback ) == 'function' ) callback();
if ( typeof( dbo.notifyModel.callback ) == 'function' ) callback();
}
}
ko.applyBindings( pp.notifyModel, document.getElementById( "notify-me" ) );
ko.applyBindings( dbo.notifyModel, document.getElementById( "notify-me" ) );