Skip to content

Commit

Permalink
Add to Github.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsoares committed May 10, 2016
0 parents commit b90ab77
Show file tree
Hide file tree
Showing 11 changed files with 1,289 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Roundcube Plugin Lastlogin
============================

Roundcube plugin to save and show user login information (user login history).

When a user logs in into Roundcube, this plugin:

1. shows the last user login information in a small box for N configurable seconds;
2. saves the information to a database table for history purposes.

If using the geolocation plugin and you have configured your organization internal networks, that information will be shown. For more information, see the geolocation plugin configuration.

This plugin provides a section in settings for the user to configure the number of seconds to show the information on login.

Stable versions of Lastlogin are available from the [Roundcube plugin repository][rcplugrepo] or the [releases section][releases] of the GitHub repository.


Requirements
------------

- [Roundcube Plugin Geolocation][geolocation] if the config option `lastlogin_geolocation` is `true` (default).


Installation with composer
----------------------------------------

Add the plugin to your `composer.json` file:

"require": {
(...)
"dsoares/lastlogin": "~0.1"
}

And run `$ composer update [--your-options]`.

Manual Installation
----------------------------------------

Place this directory under your Rouncdube `plugins/` folder, copy `config.inc.php.dist` to `config.inc.php` and modify it as necessary.
Then, you need to import the database script:

mysql -your_mysql_connection_options your_roundcube_database_name < SQL/mysql.initial.sql

NOTE: The plugin ships only with a MySQL/MariaDB script `SQL/mysql.initial.sql`; you are welcome to contribute with other database drivers.

Don't forget to enable the lastlogin plugin within the main Roundcube configuration file `config/config.inc.php`.


Configuration
----------------------------------------

- **$config['lastlogin_timeout']** - number of seconds to show the user login info at login; default is `10`.

- **$config['lastlogin_lastrecords']** - number of history entries to show in the settings section; default is `10`.

- **$config['lastlogin_geolocation']** - use the geolocation plugin; default is `true`.

See the `config.inc.php.dist` for more information.

License
----------------------------------------

This plugin is released under the [GNU General Public License Version 3+][gpl].

Contact
----------------------------------------

Comments and suggestions are welcome!

Email: [Diana Soares][dsoares]

[rcplugrepo]: http://plugins.roundcube.net/packages/dsoares/lastlogin
[releases]: http://github.com/JohnDoh/Roundcube-Plugin-Lastlogin/releases
[geolocation]: http://plugins.roundcube.net/packages/dsoares/geolocation
[gpl]: http://www.gnu.org/licenses/gpl.html
[dsoares]: mailto:[email protected]
25 changes: 25 additions & 0 deletions SQL/mysql.initial.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--
-- Plugin last_login: initial MYSQL database structure
--

/*!40014 SET FOREIGN_KEY_CHECKS=0 */;


-- Table structure for table `userlogins`

CREATE TABLE IF NOT EXISTS `userlogins` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_id` int(10) unsigned NOT NULL DEFAULT 0,
`username` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`session_id` varchar(128) NOT NULL DEFAULT '',
`ip` varchar(20) NOT NULL DEFAULT '',
`real_ip` varchar(20) NOT NULL DEFAULT '',
`hostname` varchar(255) NOT NULL DEFAULT '',
`geoloc` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
INDEX `user_id` (`user_id`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;


/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
1 change: 1 addition & 0 deletions SQL/mysql/2016050100.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- empty
32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "dsoares/lastlogin",
"type": "roundcube-plugin",
"description": "Roundcube plugin to save and show user login information and login history.",
"keywords": ["mail","login","history"],
"homepage": "https://github.com/dsoares/Roundcube-Plugin-Lastlogin",
"license": "GPL-3.0+",
"authors": [
{
"name": "Diana Soares",
"email": "[email protected]",
"homepage": "https://github.com/dsoares"
}
],
"repositories": [
{
"type": "composer",
"url": "https://plugins.roundcube.net"
}
],
"require": {
"php": ">=5.2.1",
"roundcube/plugin-installer": "~0.1.3",
"dsoares/geolocation": "~0.1"
},
"extra": {
"roundcube": {
"min-version": "1.0",
"sql-dir": "SQL"
}
}
}
13 changes: 13 additions & 0 deletions config.inc.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* Lastlogin configuration file.
*/

// Default number of seconds to show the lastlogin info at login.
$config['lastlogin_timeout'] = 10;

// Number of entries to show in user login history.
$config['lastlogin_lastrecords'] = 10;

// Use geolocation plugin.
$config['lastlogin_geolocation'] = true;
Loading

0 comments on commit b90ab77

Please sign in to comment.