Skip to content

Commit

Permalink
devise with rails 7
Browse files Browse the repository at this point in the history
  • Loading branch information
yshmarov committed Feb 16, 2023
1 parent f4b7b89 commit 4717a4a
Show file tree
Hide file tree
Showing 13 changed files with 493 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ group :test do
end

gem "faker", "~> 3.1"

gem 'devise', github: "heartcombo/devise", branch: "main"

This comment has been minimized.

Copy link
@yshmarov

yshmarov Feb 16, 2023

Author Member

Use MAIN branch!

20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GIT
remote: https://github.com/heartcombo/devise.git
revision: 44f0fd741f51bb71e2dd4219200acc5c91aef449
branch: main
specs:
devise (4.9.0.alpha)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -68,6 +80,7 @@ GEM
tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
bcrypt (3.1.18)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand Down Expand Up @@ -129,6 +142,7 @@ GEM
nio4r (2.5.8)
nokogiri (1.14.2-arm64-darwin)
racc (~> 1.4)
orm_adapter (0.5.0)
pg (1.4.5)
public_suffix (5.0.1)
puma (5.6.5)
Expand Down Expand Up @@ -168,6 +182,9 @@ GEM
regexp_parser (2.7.0)
reline (0.3.2)
io-console (~> 0.5)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rubyzip (2.3.2)
selenium-webdriver (4.8.0)
Expand All @@ -191,6 +208,8 @@ GEM
railties (>= 6.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand All @@ -215,6 +234,7 @@ DEPENDENCIES
bootsnap
capybara
debug
devise!
faker (~> 3.1)
importmap-rails
jbuilder
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class ApplicationController < ActionController::Base
before_action :authenticate_user!
end
6 changes: 6 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
end
9 changes: 9 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
</head>

<body>
<% if signed_in? %>
<%= link_to current_user.email, edit_user_registration_path %>
<%= button_to "Log out", destroy_user_session_path, method: :delete, data: { turbo: "false" } %>
<% else %>
<%= link_to "Log in", new_user_session_path %>
<%= link_to "Register", new_user_registration_path %>
<% end %>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
</body>
</html>
1 change: 1 addition & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "active_support/core_ext/integer/time"

Rails.application.configure do
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded any time
Expand Down

0 comments on commit 4717a4a

Please sign in to comment.