{"id":16758202,"url":"https://github.com/foo123/loginmanager","last_synced_at":"2025-03-16T07:25:44.248Z","repository":{"id":56866996,"uuid":"510271263","full_name":"foo123/LoginManager","owner":"foo123","description":"Simple, barebones agnostic login manager for PHP, JavaScript, Python","archived":false,"fork":false,"pushed_at":"2022-08-19T17:57:50.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T19:48:41.968Z","etag":null,"topics":["login","login-system"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foo123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-04T08:18:44.000Z","updated_at":"2022-12-17T20:51:17.000Z","dependencies_parsed_at":"2022-08-19T23:40:56.146Z","dependency_job_id":null,"html_url":"https://github.com/foo123/LoginManager","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FLoginManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FLoginManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FLoginManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FLoginManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/LoginManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243838310,"owners_count":20356012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["login","login-system"],"created_at":"2024-10-13T04:04:29.654Z","updated_at":"2025-03-16T07:25:44.227Z","avatar_url":"https://github.com/foo123.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LoginManager\n\nSimple, barebones login manager for PHP, JavaScript, Python\n\nversion **1.1.1**\n\n![Login Manager](/loginmanager.jpg)\n\n**see also:**\n\n* [ModelView](https://github.com/foo123/modelview.js) a simple, fast, powerful and flexible MVVM framework for JavaScript\n* [tico](https://github.com/foo123/tico) a tiny, super-simple MVC framework for PHP\n* [LoginManager](https://github.com/foo123/LoginManager) a simple, barebones agnostic login manager for PHP, JavaScript, Python\n* [SimpleCaptcha](https://github.com/foo123/simple-captcha) a simple, image-based, mathematical captcha with increasing levels of difficulty for PHP, JavaScript, Python\n* [Dromeo](https://github.com/foo123/Dromeo) a flexible, and powerful agnostic router for PHP, JavaScript, Python\n* [PublishSubscribe](https://github.com/foo123/PublishSubscribe) a simple and flexible publish-subscribe pattern implementation for PHP, JavaScript, Python\n* [Importer](https://github.com/foo123/Importer) simple class \u0026amp; dependency manager and loader for PHP, JavaScript, Python\n* [Contemplate](https://github.com/foo123/Contemplate) a fast and versatile isomorphic template engine for PHP, JavaScript, Python\n* [HtmlWidget](https://github.com/foo123/HtmlWidget) html widgets, made as simple as possible, both client and server, both desktop and mobile, can be used as (template) plugins and/or standalone for PHP, JavaScript, Python (can be used as [plugins for Contemplate](https://github.com/foo123/Contemplate/blob/master/src/js/plugins/plugins.txt))\n* [Paginator](https://github.com/foo123/Paginator)  simple and flexible pagination controls generator for PHP, JavaScript, Python\n* [Formal](https://github.com/foo123/Formal) a simple and versatile (Form) Data validation framework based on Rules for PHP, JavaScript, Python\n* [Dialect](https://github.com/foo123/Dialect) a cross-vendor \u0026amp; cross-platform SQL Query Builder, based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\n* [DialectORM](https://github.com/foo123/DialectORM) an Object-Relational-Mapper (ORM) and Object-Document-Mapper (ODM), based on [Dialect](https://github.com/foo123/Dialect), for PHP, JavaScript, Python\n* [Unicache](https://github.com/foo123/Unicache) a simple and flexible agnostic caching framework, supporting various platforms, for PHP, JavaScript, Python\n* [Xpresion](https://github.com/foo123/Xpresion) a simple and flexible eXpression parser engine (with custom functions and variables support), based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\n* [Regex Analyzer/Composer](https://github.com/foo123/RegexAnalyzer) Regular Expression Analyzer and Composer for PHP, JavaScript, Python\n\n\n**Example:**\n\n```php\n// setup\n$lm = new LoginManager();\n$lm\n-\u003eoption('secret_salt', 'SALT')\n-\u003eoption('set_token', function($name, $value, $expires) {\n    // for example use HTTP cookies to store auth token\n    // other option would be storing it in $_SESSION\n    $_COOKIE[$name] = $value;\n    setcookie(\n        $name,\n        $value,\n        $expires,\n        \"\",\n        \"\",\n        false,\n        true\n    );\n})\n-\u003eoption('unset_token', function($name) {\n    // for example use HTTP cookies to store auth token\n    // other option would be storing it in $_SESSION\n    unset($_COOKIE[$name]);\n    setcookie(\n        $name,\n        \"\",\n        0,\n        \"\",\n        \"\",\n        false,\n        true\n    );\n})\n-\u003eoption('get_token', function($name) {\n    // for example use HTTP cookies to store auth token\n    // other option would be storing it in $_SESSION\n    return isset($_COOKIE[$name]) ? $_COOKIE[$name] : null;\n})\n-\u003eoption('get_user', function($username, $password = false) use ($mymodel) {\n    $user = false !== $password ? $mymodel-\u003efindByUserNameAndPassword($username, $password) : $mymodel-\u003efindByUserName($username);\n    return empty($user) ? null : new LoginManagerUser($user-\u003eusername, $user-\u003epassword, $user /*original user object*/);\n})\n// optional\n-\u003eoption('get_guest', function() {\n    return new LoginManagerUser('guest', null, (object)array('id'=\u003e0,'username'=\u003e'guest'));\n})\n;\n// use it\n$app-\u003eon('/login', function() use ($lm) {\n    $success = $lm-\u003elogin($_POST['username'], $_POST['password'], !empty($_POST['rememberme']));\n    if ($success) $app-\u003eredirect('/', 302);\n    else $app-\u003eoutput('login.tpl', ['error' =\u003e 'Invalid username or password']);\n});\n$app-\u003eon('/logout', function() use ($lm) {\n    $lm-\u003elogout();\n    $app-\u003eredirect('/', 302);\n});\n$app-\u003eon('/admin', function() use ($lm) {\n    if (!$lm-\u003eisLoggedIn()) $app-\u003eredirect('/login');\n    else $app-\u003eoutput('admin.tpl', ['user'=\u003e$lm-\u003egetUser() /*original user object*/]);\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Floginmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Floginmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Floginmanager/lists"}