Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

any_login

> 编程语言
Open source

Easy way to login as any user in system

387 stars0 likes3 views
WebsiteGitHub

About

Easy way to login as any user in system

AnyLogin Gem

Description

Demo available on: https://any-login.herokuapp.com (source code for demo https://github.com/igorkasyanchuk/any_login_test)

Video Demo: https://youtu.be/978DlHvufSY

AnyLogin was created to speed up the development process by allowing developers to quickly log in as any user.

Give it a try; if you like it please share AnyLogin with friends. If you have any suggestions please feel free to contact me.

Requirements

Ruby: >= 3.0, Rails: >= 6.1. Pre-configured to work with Devise, Authlogic, Clearance or Sorcery gems.

For Rails User.admins.limit(10), 'moderator' => User.moderators.limit(10), 'user' => User.users.limit(10) } end end


Or another sample:

```ruby
# Initializer: config/initializers/any_login.rb
AnyLogin.setup do |config|
  config.collection_method = :grouped_users
  # to format user name in dropdown list
  config.name_method = :any_login_name
end

# User class: app/models/user.rb
class User < ActiveRecord::Base
  def any_login_name
    [full_name + ' - ' + email + " Domains: #{domains.collect(&:short_code).join(',').presence || 'none'}; Role: #{role}; ID: #{id}", id]
  end

  def self.grouped_users
    Organization.ordered.includes(:employees).inject({}) do |res, org|
      res[org.name] = org.employees.ordered.includes([:domains, :organization])
      res
    end
  end
end

Production

If you want to completely disable gem in production add following code in your config/environments/production.rb file.

ruby
AnyLogin.setup do |config|
  config.enabled = false
end

You can also try to debug your application in production and secure AnyLogin with HTTP_BASIC authentication. See Options sections for more details.

Future Plans

  1. Add tests
  2. Add support for more authentication gems like Devise, Authlogic, Clearance (restful_authentication, monban, letmein)

Contributors

  • @incubus
  • @bbenezech
  • @manastyretskyi
  • @saiqulhaq
  • @zorab47
  • @shivabhusal
  • @eliotsykes
  • @sviatoslav-krupa
  • @daichirata
  • @linshaodongsam
  • @jr180180
  • @vmyts539
  • @rbclark
  • @OskarsEzerins
  • @kyohah

For CI

Update gemspec:

bash
BUNDLE_GEMFILE=./gemfiles/rails_8_0.gemfile bundle

Tests

To setup test apps:

./prepare.sh

and

bundle exec appraisal install

To run tests:

bash

bundle exec appraisal rails-8-0 bundle exec test_devise
bundle exec appraisal rails-8-0 bundle exec test_clearance
bundle exec appraisal rails-8-0 bundle exec test_authlogic
bundle exec appraisal rails-8-0 bundle exec test_sorcery

# or

bundle exec appraisal rails-8-0 bundle exec rails test test/devise/
bundle exec appraisal rails-8-0 bundle exec rails test test/authlogic/
bundle exec appraisal rails-8-0 bundle exec rails test test/clearance/
bundle exec appraisal rails-8-0 bundle exec rails test test/sorcery/

If you want to manually tests open test/rails_apps/devise/ and run BUNDLE_GEMFILE=../../../gemfiles/rails_8_0.gemfile bundle exec rails s and open http://localhost:3000 (and with other gems)

Note: with Devise it can glitch in dummy app so I suggest to connect to real app using:

ruby
  gem 'any_login', path: '../any_login'

Other

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言