Topic: Admin Plugin for Morfy CMS
This plugin actually doesn’t do anything much, but I think it’s needed to simplify all of the other possible plugins that is related to administration. Like this one. Thinking that it would be easier to users if they can have a “one-time login authentication for all required login pages and plugins” related to administration things.
Installation
1. Download and extract this file, put the admin folder with its contents in plugins folder.
2. Update your config.php file:
<?php return array( ... ... ... 'plugins' => array( 'markdown', 'sitemap', 'admin' // <= Activation ), 'admin_config' => array( // <= Configuration 'username' => 'admin', // <= Change with your username 'password' => 'test123', // <= Change with your password 'classes' => array( // <= List of item's HTML classes 'page_login' => 'page-login', 'page_logout' => 'page-logout', 'page_wrapper' => 'page-wrapper', 'message' => 'message', 'error' => 'error', 'success' => 'success' ), 'labels' => array( // <= List of item's readable text or labels 'username' => 'Username', 'password' => 'Password', 'login' => 'Login', 'logout' => 'Logout', 'title_login' => 'Administrator', 'title_logout' => 'Administrator', 'message_logged_in' => 'You are logged in.', 'message_logged_out' => 'You are logged out.', 'message_error_invalid' => 'Invalid username or password.', 'message_error_required' => 'Please fill out the login form.', 'message_error_token' => 'Invalid token.' ) ) );
Change the value of username and password as you wish. Finish. You can access the login and logout page via this URL:
http://localhost/{test_morfy}/admin/login
http://localhost/{test_morfy}/admin/logout
If the login is success, then this plugin will automatically insert new global variable called Morfy::$config['logged_in']
You can use it as a conditional check to display something that can only be viewed by the administrator:
if(Morfy::$config['logged_in']) { echo '<p>You are logged in.</p>'; }
I’ve checked the possibility of security holes in the system as I can. Please tell me if there is any problem with the security.