Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User sign in #1321

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'bcrypt', '~> 3.1.7'
gem 'devise'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
Expand All @@ -46,3 +47,5 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
24 changes: 23 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: https://github.com/mimemagicrb/mimemagic.git
revision: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f
ref: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f
specs:
mimemagic (0.3.5)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -58,6 +65,7 @@ GEM
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
bcrypt (3.1.16)
bindex (0.8.1)
builder (3.2.4)
byebug (11.1.3)
Expand All @@ -71,6 +79,12 @@ GEM
childprocess (3.0.0)
concurrent-ruby (1.1.9)
crass (1.0.6)
devise (4.8.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
erubi (1.10.0)
execjs (2.7.0)
Expand All @@ -93,14 +107,14 @@ GEM
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.5.3)
minitest (5.14.4)
nio4r (2.5.5)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
orm_adapter (0.5.0)
pg (1.2.3)
public_suffix (4.0.6)
puma (3.12.6)
Expand Down Expand Up @@ -138,6 +152,9 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
Expand Down Expand Up @@ -184,6 +201,8 @@ GEM
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.1.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand All @@ -200,10 +219,13 @@ PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
byebug
capybara (~> 2.13)
devise
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
mimemagic!
pg
puma (~> 3.12.6)
rails (~> 6.0.0)
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/user_sign_in.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the UserSignIn controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

end
4 changes: 4 additions & 0 deletions app/controllers/user_sign_in_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class UserSignInController < ApplicationController
before_action :authenticate_user!

end
2 changes: 2 additions & 0 deletions app/helpers/user_sign_in_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module UserSignInHelper
end
6 changes: 6 additions & 0 deletions app/models/user_sign_in.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class UserSignIn < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
end
13 changes: 13 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@
</head>

<body>

<% if notice %>
<p class="alert alert-success"><%= notice %></p>
<% end %>
<% if alert %>
<p class="alert alert-danger"><%= alert %></p>
<% end %>


<%= link_to 'Sign out', destroy_user_sign_in_session_path, method: :delete %>

<%= yield %>


</body>
</html>
1 change: 1 addition & 0 deletions app/views/user_sign_in/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1> Hello World </h1>
Loading