From d9dbf46b20eb73b5f43e2a42278470ba2c84ff51 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sun, 1 Jun 2025 09:59:39 -0700 Subject: [PATCH 1/2] Bump version for next release --- shard.yml | 8 +++----- src/authentic/version.cr | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/shard.yml b/shard.yml index 8d40f67..8d4f609 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: authentic -version: 1.0.1 +version: 1.0.2 authors: - Paul Smith @@ -11,12 +11,10 @@ license: MIT dependencies: lucky: github: luckyframework/lucky - branch: main - # version: ">= 1.0.0" + version: ">= 1.0.0" avram: github: luckyframework/avram - branch: main - # version: ">= 1.0.0" + version: ">= 1.0.0" habitat: github: luckyframework/habitat version: ~> 0.4.9 diff --git a/src/authentic/version.cr b/src/authentic/version.cr index d25d4e6..2ed5a11 100644 --- a/src/authentic/version.cr +++ b/src/authentic/version.cr @@ -1,3 +1,3 @@ module Authentic - VERSION = "1.0.1" + VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }} end From 5b159b05494f7fc65493760b5f3c01bb0f546716 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sun, 1 Jun 2025 10:03:42 -0700 Subject: [PATCH 2/2] Formatting fixes --- spec/support/context_helper.cr | 2 +- src/authentic.cr | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/support/context_helper.cr b/spec/support/context_helper.cr index 6984526..a4dcf35 100644 --- a/spec/support/context_helper.cr +++ b/spec/support/context_helper.cr @@ -3,7 +3,7 @@ class ContextHelper def initialize( @path : String = "/", - @method : String = "GET" + @method : String = "GET", ) end diff --git a/src/authentic.cr b/src/authentic.cr index 67c3924..d7ccaf9 100644 --- a/src/authentic.cr +++ b/src/authentic.cr @@ -77,7 +77,7 @@ module Authentic # page before sign in. def self.redirect_to_originally_requested_path( action : Lucky::Action, - fallback : Lucky::Action.class | Lucky::RouteHelper + fallback : Lucky::Action.class | Lucky::RouteHelper, ) : Lucky::Response return_to = action.session.get?(:return_to) action.session.delete(:return_to) @@ -92,7 +92,7 @@ module Authentic # ``` def self.correct_password?( authenticatable : Authentic::PasswordAuthenticatable, - password_value : String + password_value : String, ) : Bool encrypted_password = authenticatable.encrypted_password @@ -119,7 +119,7 @@ module Authentic # ``` def self.copy_and_encrypt( from password_field : Avram::Attribute | Avram::PermittedAttribute, - to encrypted_password_field : Avram::Attribute | Avram::PermittedAttribute + to encrypted_password_field : Avram::Attribute | Avram::PermittedAttribute, ) : Nil password_field.value.try do |value| encrypted_password_field.value = generate_encrypted_password(value) @@ -131,7 +131,7 @@ module Authentic # By default it uses Bcrypt to encrypt the password. def self.generate_encrypted_password( password_value : String, - encryptor = Crypto::Bcrypt::Password + encryptor = Crypto::Bcrypt::Password, ) : String encryptor.create( password_value, @@ -142,7 +142,7 @@ module Authentic # Generates a password reset token def self.generate_password_reset_token( authenticatable : Authentic::PasswordAuthenticatable, - expires_in : Time::Span = Authentic.settings.default_password_reset_time_limit + expires_in : Time::Span = Authentic.settings.default_password_reset_time_limit, ) : String encryptor = Lucky::MessageEncryptor.new(secret: settings.secret_key) encryptor.encrypt_and_sign("#{authenticatable.id}:#{expires_in.from_now.to_unix_ms}") @@ -156,7 +156,7 @@ module Authentic # To generate a token see `Authentic.generate_password_reset_token` def self.valid_password_reset_token?( authenticatable : Authentic::PasswordAuthenticatable, - token : String + token : String, ) : Bool encryptor = Lucky::MessageEncryptor.new(secret: settings.secret_key) user_id, expiration_in_ms = String.new(encryptor.verify_and_decrypt(token)).split(":")