diff --git a/Gemfile b/Gemfile index cc33a496eb..028086e1b3 100644 --- a/Gemfile +++ b/Gemfile @@ -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 @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index d68ece3372..3a0cf3c088 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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: @@ -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) @@ -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) @@ -93,7 +107,6 @@ 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) @@ -101,6 +114,7 @@ GEM 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) @@ -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) @@ -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) @@ -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) diff --git a/app/assets/stylesheets/user_sign_in.scss b/app/assets/stylesheets/user_sign_in.scss new file mode 100644 index 0000000000..8beaf7d9b2 --- /dev/null +++ b/app/assets/stylesheets/user_sign_in.scss @@ -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/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c07694e9d..ab22b60457 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception + end diff --git a/app/controllers/user_sign_in_controller.rb b/app/controllers/user_sign_in_controller.rb new file mode 100644 index 0000000000..470ed300dc --- /dev/null +++ b/app/controllers/user_sign_in_controller.rb @@ -0,0 +1,4 @@ +class UserSignInController < ApplicationController + before_action :authenticate_user! + +end diff --git a/app/helpers/user_sign_in_helper.rb b/app/helpers/user_sign_in_helper.rb new file mode 100644 index 0000000000..e4ed2e31e5 --- /dev/null +++ b/app/helpers/user_sign_in_helper.rb @@ -0,0 +1,2 @@ +module UserSignInHelper +end diff --git a/app/models/user_sign_in.rb b/app/models/user_sign_in.rb new file mode 100644 index 0000000000..b3a15b0cad --- /dev/null +++ b/app/models/user_sign_in.rb @@ -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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1d2a9c14f9..5d89233d75 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,6 +9,19 @@
+ + <% if notice %> +<%= notice %>
+<% end %> +<% if alert %> +<%= alert %>
+<% end %> + + +<%= link_to 'Sign out', destroy_user_sign_in_session_path, method: :delete %> + <%= yield %> + +