{"id":20586075,"url":"https://github.com/charlotte-ruby/lock","last_synced_at":"2025-10-24T18:37:14.542Z","repository":{"id":958788,"uuid":"1450044","full_name":"charlotte-ruby/lock","owner":"charlotte-ruby","description":"Simple plugin that allows you to lock all or part of your app with a single password.  Useful for hiding new features that are being beta tested","archived":false,"fork":false,"pushed_at":"2022-12-11T16:40:45.000Z","size":208,"stargazers_count":23,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T09:21:16.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charlotte-ruby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-03-07T13:13:58.000Z","updated_at":"2023-06-19T00:27:13.000Z","dependencies_parsed_at":"2023-01-13T10:48:42.156Z","dependency_job_id":null,"html_url":"https://github.com/charlotte-ruby/lock","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/charlotte-ruby%2Flock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlotte-ruby%2Flock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlotte-ruby%2Flock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charlotte-ruby%2Flock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charlotte-ruby","download_url":"https://codeload.github.com/charlotte-ruby/lock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961237,"owners_count":21189993,"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":[],"created_at":"2024-11-16T07:10:09.316Z","updated_at":"2025-10-24T18:37:14.488Z","avatar_url":"https://github.com/charlotte-ruby.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Lock Logo](https://github.com/charlotte-ruby/lock/blob/master/logo.png?raw=true)\n\n# Lock\n\n[![ruby](https://github.com/charlotte-ruby/lock/actions/workflows/ruby.yml/badge.svg)](https://github.com/charlotte-ruby/lock/actions/workflows/ruby.yml)\n\nA simple Rails Engine that lets you lock down controllers, specific actions or an entire site with a password.  This engine is useful for locking down new features\nor your entire site in production while your app is being beta tested.  This is not a full-blown user authentication engine, nor is it intended to be.\n\n## Install the gem\n\nAdd to your Gemfile\n\n```\nbundle add 'lock'\n```\n\nInstall with bundler\n\n```\nbundle install\n```\n\n## Generate password file\n\nThe following command will generate /config/lock_password, which contains an encrypted password.  Lock uses this for authentication\n\n```\nrails g lock:create_password_file yourpasswordhere\n```\n\n## Lock your app\n\nYou lock your app in the ApplicationController (/app/controllers/application_controller.rb).\n\nIf you want to lock your entire app use this:\n\n```ruby\nApplicationController \u003c ActionController::Base\n  lock\nend\n```\n\nIf you want to lock specific actions inside the widgets_controller use this:\n\n\n```ruby\nApplicationController \u003c ActionController::Base\n  lock actions: [\"widgets#new\", \"widgets#index\"]\nend\n```\n\nIf you want to lock all actions in a controller, you can just leave off the # sign and action name.  The following will lock all actions in the widgets_controller\n\n```ruby\nApplicationController \u003c ActionController::Base\n  lock actions: [\"widgets\"]\nend\n```\n\n## Unlock your app\n\n1. Use the lock login url - /lock/login\n2. Type in your password (from the generator) and press unlock\n\n## Override the views\n\nYou may want to customize the views to fit your app.  The easiest way to achieve this is to create the lock views directory - /app/views/lock, and\nadd your own view files.  The views should be named:\n\n```\n/app/views/lock/refused.html.erb  #message shown to users when they access a locked page\n/app/views/lock/login.html.erb    #login form\n/app/views/lock/unlock.html.erb   #shows a confirmation message after you unlock it\n```\n\nIf you choose to override the login page, you will need to create a form that posts to /lock/unlock and uses a password field\nnamed \"password\".\n\nBy default, these views will render inside your default layout.  To create a custom layout for these files, just add /app/views/layouts/lock.html.erb\nThe layout must contain a yield.\n\n## Contributing to lock\n\n* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet\n* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it\n* Fork the project\n* Start a feature/bugfix branch\n* Commit and push until you are happy with your contribution\n* Make sure to add tests for it. Patches without tests will be ignored\n* Please try not to mess with the Rakefile, version, or history.\n\nCopyright\n---------\n\nCopyright (c) 2011-2022 cowboycoded and the Charlotte Ruby User Group. See LICENSE.txt for\nfurther details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlotte-ruby%2Flock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharlotte-ruby%2Flock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharlotte-ruby%2Flock/lists"}