Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpigford committed Feb 2, 2024
2 parents 3bf7b47 + eb762c3 commit 55c352e
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ gem "jbuilder"
# Use Redis adapter to run Action Cable in production
gem "redis", ">= 4.0.1"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ GEM
bindex (0.8.1)
bootsnap (1.18.3)
msgpack (~> 1.2)
brakeman (6.1.1)
brakeman (6.1.2)
racc
builder (3.2.4)
capybara (3.40.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def current_family

def authenticate_user_from_session
User.find_by(id: session[:user_id])
end
end

def user_signed_in?
current_user.present?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PagesController < ApplicationController
before_action :authenticate_user!

def dashboard
end
end
3 changes: 1 addition & 2 deletions app/controllers/password_resets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PasswordResetsController < ApplicationController
layout "auth"

def new
end

Expand Down Expand Up @@ -37,4 +37,3 @@ def password_params
params.require(:user).permit(:password, :password_confirmation)
end
end

1 change: 0 additions & 1 deletion app/controllers/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ def password_params
params.require(:user).permit(:password, :password_confirmation, :password_challenge).with_defaults(password_challenge: "")
end
end

3 changes: 1 addition & 2 deletions app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class RegistrationsController < ApplicationController
layout "auth"

def new
@user = User.new
end
Expand All @@ -27,4 +27,3 @@ def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
end
end

5 changes: 2 additions & 3 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class SessionsController < ApplicationController
layout "auth"

def new
end

Expand All @@ -13,10 +13,9 @@ def create
render :new, status: :unprocessable_entity
end
end

def destroy
logout
redirect_to root_path, notice: "You have signed out successfully."
end
end

2 changes: 1 addition & 1 deletion app/models/current.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Current < ActiveSupport::CurrentAttributes
attribute :user
end
end
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class User < ApplicationRecord
has_secure_password

belongs_to :family

validates :email, presence: true, uniqueness: true
normalizes :email, with: -> (email) { email.strip.downcase }
normalizes :email, with: ->(email) { email.strip.downcase }

generates_token_for :password_reset, expires_in: 15.minutes do
password_salt&.last(10)
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Rails.application.config.generators do |g|
g.orm :active_record, primary_key_type: :uuid
end
end

0 comments on commit 55c352e

Please sign in to comment.