Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/runlevel5/basic_rails_auth_demo

An example how to properly implement Rails basic auhentication
https://github.com/runlevel5/basic_rails_auth_demo

Last synced: about 8 hours ago
JSON representation

An example how to properly implement Rails basic auhentication

Awesome Lists containing this project

README

        

# Rails Basic Auth demo

Devise or any Warden-based solutions are widely-used but
unattractive for its complexity.

I am going to show you how to implement a very basic auth
for Rails with BCrypt.

Please be noted that my code does not contain any ActiveRecord
callbacks and I also heavily use DCI Service Object pattern.

## Setup

1. Bootstrap DB

```ruby
rake db:create db:migrate
```

2. Create new user under `rails console`

```ruby
UserCreation.create(email: 'your_email', password: 'pass', password_confirmation: 'pass')
```

3. Run server `rails server`

4. You can test the login

## Testing

```ruby
RAILS_ENV=tes rake db:schema:load
bundle exec rake spec
```

## Author

Trung Lê

## License

MIT