mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Login/Logout
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Auth extends FHC_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load Helpers
|
||||
$this->load->helper('form');
|
||||
$this->load->helper('hlp_authentication');
|
||||
|
||||
// Loads phrases system
|
||||
$this->loadPhrases([
|
||||
'global'
|
||||
]);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('username', 'Username', 'required|trim|callback_validation');
|
||||
$this->form_validation->set_rules('password', 'Password', 'required|trim');
|
||||
|
||||
|
||||
if ($this->form_validation->run())
|
||||
{
|
||||
redirect($this->authlib->getLandingPage('/CisVue/Dashboard'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->view('Cis/Login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function validation()
|
||||
{
|
||||
$username = $this->input->post('username');
|
||||
$password = $this->input->post('password');
|
||||
|
||||
$this->load->library('AuthLib', [false]); // without authentication otherwise loooooop!
|
||||
|
||||
$login = $this->authlib->loginLDAP($username, $password);
|
||||
if (isSuccess($login))
|
||||
return true;
|
||||
$this->form_validation->set_message('validation', 'Incorrect username/password.');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
$this->load->library('AuthLib');
|
||||
$this->authlib->logout();
|
||||
redirect('/Cis/Auth/login', 'refresh');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,12 +3,7 @@
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the FilterCmptLib (back-end)
|
||||
* Provides data to the ajax get calls about the filter component
|
||||
* Listens to ajax post calls to change the filter data
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the FilterCmpt has its
|
||||
* own permissions check
|
||||
*
|
||||
*/
|
||||
class CisVue extends Auth_Controller
|
||||
{
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
$includesArray = array(
|
||||
'title' => 'FH-Complete',
|
||||
'bootstrap5' => true,
|
||||
'fontawesome6' => true
|
||||
);
|
||||
|
||||
$this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<div id="login-form" class="login-form container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-9 col-lg-7 col-xl-6">
|
||||
<?= form_open('Cis/Auth/login'); ?>
|
||||
<p class="text-center">
|
||||
<img src="<?php echo base_url('public/images/logo-300x160.png'); ?>" >
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
<?= validation_errors('<div class="alert alert-danger" role="alert">', '</div>'); ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<?= form_input(['name' => 'username', 'class' => 'form-control', 'placeholder' => 'Username', 'required' => true]); ?>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<?= form_password(['name' => 'password', 'class' => 'form-control', 'placeholder' => 'Password', 'required' => true]); ?>
|
||||
</div>
|
||||
|
||||
<div class="d-grid mb-3">
|
||||
<?= form_button(['type' => 'submit', 'class' => 'btn btn-primary'], 'Log in'); ?>
|
||||
</div>
|
||||
|
||||
<p class="text-center"><a href="#">Forgot Password?</a></p>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#" id="menu-profil">Profil</a></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Ampeln</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Logout</a></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="<?= site_url('Cis/Auth/logout'); ?>">Logout</a></li>
|
||||
</ul>
|
||||
<div id="nav-main-menu" class="collapse collapse-horizontal show">
|
||||
<div>
|
||||
|
||||
@@ -45,7 +45,7 @@ if (!isset($menu)) {
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#" id="menu-profil">Profil</a></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Ampeln</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Logout</a></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="<?= site_url('Cis/Auth/logout'); ?>">Logout</a></li>
|
||||
</ul>
|
||||
<div id="nav-main-menu" class="collapse collapse-horizontal show">
|
||||
<div>
|
||||
|
||||
@@ -18,6 +18,6 @@ $this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
|
||||
<header id="cis-header" class="navbar-dark">
|
||||
<cis-menu root-url="<?= site_url('CisVue'); ?>" logo-url="<?= base_url('/public/images/logo-300x160.png'); ?>" avatar-url="<?= base_url('/cis/public/bild.php?src=person&person_id=' . getAuthPersonId()); ?>" :searchbaroptions="searchbaroptions" :searchfunction="searchfunction" />
|
||||
<cis-menu root-url="<?= site_url('CisVue'); ?>" logo-url="<?= base_url('/public/images/logo-300x160.png'); ?>" avatar-url="<?= base_url('/cis/public/bild.php?src=person&person_id=' . getAuthPersonId()); ?>" logout-url="<?= site_url('Cis/Auth/logout'); ?>" :searchbaroptions="searchbaroptions" :searchfunction="searchfunction" />
|
||||
</header>
|
||||
<main id="cis-main" class="flex-grow-1 overflow-scroll p-4">
|
||||
|
||||
@@ -182,6 +182,9 @@
|
||||
width: 100vw;
|
||||
/* overflow: visible !important; */
|
||||
}
|
||||
#cis-header {
|
||||
z-index: 10;
|
||||
}
|
||||
#cis-header nav {
|
||||
position: initial;
|
||||
transform: none;
|
||||
@@ -269,7 +272,7 @@
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
z-index: 1;
|
||||
z-index: 10;
|
||||
}
|
||||
#cis-header nav {
|
||||
top: var(--fhc-cis-header-height);
|
||||
|
||||
@@ -19,7 +19,11 @@ export default {
|
||||
default: true
|
||||
},
|
||||
noCloseBtn: Boolean,
|
||||
dialogClass: [String,Array,Object]
|
||||
dialogClass: [String,Array,Object],
|
||||
bodyClass: {
|
||||
type: [String,Array,Object],
|
||||
default: 'px-4 py-5'
|
||||
}
|
||||
},
|
||||
emits: [
|
||||
"hideBsModal",
|
||||
@@ -64,9 +68,9 @@ export default {
|
||||
ref: 'modal',
|
||||
'onHidden.bs.modal': instance.unmount
|
||||
}}, {
|
||||
title: () => title,
|
||||
default: () => body,
|
||||
footer: () => footer
|
||||
title: title ? () => title : undefined,
|
||||
default: body ? () => body : undefined,
|
||||
footer: footer ? () => footer : undefined
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
@@ -92,7 +96,7 @@ export default {
|
||||
<h5 class="modal-title"><slot name="title"/></h5>
|
||||
<button v-if="!noCloseBtn" type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body px-4 py-5">
|
||||
<div class="modal-body" :class="bodyClass">
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div v-if="$slots.footer" class="modal-footer">
|
||||
|
||||
@@ -10,6 +10,7 @@ export default {
|
||||
rootUrl: String,
|
||||
logoUrl: String,
|
||||
avatarUrl: String,
|
||||
logoutUrl: String,
|
||||
searchbaroptions: Object,
|
||||
searchfunction: Function
|
||||
},
|
||||
@@ -45,7 +46,7 @@ export default {
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#" id="menu-profil">Profil</a></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Ampeln</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" href="#">Logout</a></li>
|
||||
<li><a class="btn btn-level-2 rounded-0 d-block" :href="logoutUrl">Logout</a></li>
|
||||
</ul>
|
||||
<div id="nav-main-menu" class="collapse collapse-horizontal show">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user