Skip to content

Commit

Permalink
Merge branch 'main' into ms-standard
Browse files Browse the repository at this point in the history
  • Loading branch information
sej3506 authored Jun 28, 2024
2 parents 7349a49 + 1df5cf8 commit 4204144
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 17 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Build Status](https://github.com/thoughtbot/clearance/actions/workflows/tests.yml/badge.svg)]( https://github.com/thoughtbot/clearance/actions/workflows/tests.yml?query=branch%3Amain)
[![Code Climate](https://codeclimate.com/github/thoughtbot/clearance.svg)](https://codeclimate.com/github/thoughtbot/clearance)
[![Documentation Quality](https://inch-ci.org/github/thoughtbot/clearance.svg?branch=main)](https://inch-ci.org/github/thoughtbot/clearance)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)

Rails authentication with email & password.

Expand Down Expand Up @@ -63,7 +62,7 @@ Clearance.configure do |config|
config.url_after_denied_access_when_signed_out = nil
config.rotate_csrf_on_sign_in = true
config.same_site = nil
config.secure_cookie = false
config.secure_cookie = Rails.configuration.force_ssl
config.signed_cookie = false
config.sign_in_guards = []
config.user_model = "User"
Expand Down Expand Up @@ -497,4 +496,19 @@ redistributed under the terms specified in the [`LICENSE`] file.
[`LICENSE`]: /LICENSE

<!-- START /templates/footer.md -->
## About thoughtbot

![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)

This repo is maintained and funded by thoughtbot, inc.
The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software!
See [our other projects][community].
We are [available for hire][hire].

[community]: https://thoughtbot.com/community?utm_source=github
[hire]: https://thoughtbot.com/hire-us?utm_source=github


<!-- END /templates/footer.md -->
16 changes: 16 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Security Policy

## Supported Versions

We will provide security updates for the latest 3 versions.

| Version | Security updates |
| - | - |
| 2.7.x ||
| 2.6.x ||
| 2.5.x ||
| < 2.5.0 | :x: |

## Reporting a Vulnerability

You can contact <[email protected]>. See <https://thoughtbot.com/security> for more information about our security policy.
20 changes: 10 additions & 10 deletions lib/clearance.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require "clearance/configuration"
require "clearance/sign_in_guard"
require "clearance/session"
require "clearance/rack_session"
require "clearance/back_door"
require "clearance/controller"
require "clearance/user"
require "clearance/engine"
require "clearance/password_strategies"
require "clearance/constraints"
require 'clearance/configuration'
require 'clearance/sign_in_guard'
require 'clearance/session'
require 'clearance/rack_session'
require 'clearance/back_door'
require 'clearance/controller'
require 'clearance/user'
require 'clearance/password_strategies'
require 'clearance/constraints'
require 'clearance/engine'

module Clearance
end
1 change: 0 additions & 1 deletion lib/clearance/engine.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "clearance"
require "rails/engine"

module Clearance
Expand Down
2 changes: 1 addition & 1 deletion lib/clearance/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ module Validations

included do
validates :email,
email: {strict_mode: true},
email: { mode: :strict },
presence: true,
uniqueness: {allow_blank: true, case_sensitive: true},
unless: :email_optional?
Expand Down
7 changes: 4 additions & 3 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
it { is_expected.to have_db_index(:remember_token) }
it { is_expected.to validate_presence_of(:email) }
it { is_expected.to validate_presence_of(:password) }
it { is_expected.to allow_value("foo;@example.com").for(:email) }
it { is_expected.to allow_value("[email protected]").for(:email) }
it { is_expected.to allow_value("[email protected]").for(:email) }
it { is_expected.to allow_value("[email protected]").for(:email) }
it { is_expected.to allow_value("[email protected]").for(:email) }
it { is_expected.to allow_value("[email protected]").for(:email) }
it { is_expected.not_to allow_value("example.com").for(:email) }
it { is_expected.not_to allow_value("foo").for(:email) }
it { is_expected.not_to allow_value("foo@").for(:email) }
it { is_expected.not_to allow_value("foo@bar").for(:email) }
it { is_expected.not_to allow_value("foo;@example.com").for(:email) }
it { is_expected.not_to allow_value("[email protected]").for(:email) }
it { is_expected.not_to allow_value("[email protected]").for(:email) }

describe "#email" do
it "stores email in down case and removes whitespace" do
Expand Down

0 comments on commit 4204144

Please sign in to comment.