securial 1.0.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d961941c8221da3b247295215f1103d8321ae910dc7b0e3d5c1bff743e5bc3b
4
- data.tar.gz: ffa192fdfc0060e769a635063a4f326ebcf1a720fb94d8304784328675dc6338
3
+ metadata.gz: 2cd71b4330338b3487c337e3345a294c964c21b7ac34e3e5092ebb53e09db858
4
+ data.tar.gz: 8869be54802c27b6f31ec6ea4cd3e8c1c304014617e35195d6864c748a4cadde
5
5
  SHA512:
6
- metadata.gz: 84646cb2e5ed9a96f4f46baa4971086e62b7d8628e436c04e1a7ec30d6f772e74563d76163b933bd1c9d760620f763b9d96cf0bdfe1a1c43337155a8a85b1410
7
- data.tar.gz: 4103a16e922ca508481402fd9492587ab71aed2604abea521b0f6a1ab8a6d42b576258540d02ec5a080e2f0becc60b8cf6229be19a203604e22984ec70bd30eb
6
+ metadata.gz: 58922b45d9f99983f45d9003f35e7236ea881010050b91ae3fc834737537fdd8e0bda7d601f9a9c6b99440b70daf2550638c92f5dddc7c8af3eb82ee5e7b5693
7
+ data.tar.gz: 014ed5fafc13d0d94b81c8036a8d76bcb69bf3475ff100b8198d1743a238eac7cd5f3b8662799b88d759ed6c9b3bcdf790180345b08ff44b4f2f10e3bf21637f
@@ -26,12 +26,20 @@ module Securial
26
26
  # Shows a specific user's profile by username.
27
27
  #
28
28
  # Retrieves and displays public profile information for the requested user.
29
+ # Requires the `enable_other_profiles` configuration to be true.
29
30
  #
30
31
  # @param [String] params[:username] The username of the requested user profile
31
32
  # @return [void] Renders user profile with 200 OK status or 404 if not found
32
33
  def show
33
- @securial_user = Securial::User.find_by(username: params.expect(:username))
34
- render_user_profile
34
+ if Securial.configuration.enable_other_profiles
35
+ @securial_user = Securial::User.find_by(username: params.expect(:username))
36
+ render_user_profile
37
+ else
38
+ render json: {
39
+ errors: ["User profiles are not enabled"],
40
+ instructions: "Please contact support for assistance.",
41
+ }, status: :forbidden
42
+ end
35
43
  end
36
44
 
37
45
  # Registers a new user account.
data/config/routes.rb CHANGED
@@ -17,7 +17,6 @@ Securial::Engine.routes.draw do
17
17
 
18
18
  scope "accounts" do
19
19
  get "me", to: "accounts#me", as: :me
20
- get "account/:username", to: "accounts#show", as: :account_by_username
21
20
  post "register", to: "accounts#register", as: :register
22
21
  put "update", to: "accounts#update_profile", as: :update_profile
23
22
  # post "update_avatar", to: "accounts#update_avatar"
@@ -40,5 +39,9 @@ Securial::Engine.routes.draw do
40
39
  post "forgot", to: "passwords#forgot_password", as: :forgot_password
41
40
  put "reset", to: "passwords#reset_password", as: :reset_password
42
41
  end
42
+
43
+ scope "profiles" do
44
+ get ":username", to: "accounts#show", as: :profile_by_username
45
+ end
43
46
  end
44
47
  end
@@ -16,10 +16,10 @@ module Securial
16
16
  def create_log_file
17
17
  say_status("creating", "Securial Log file", :green)
18
18
  log_dir = Rails.root.join("log")
19
- securial_log = log_dir.join("securial.log")
19
+ securial_log = log_dir.join("securial-#{Rails.env}.log")
20
20
 
21
21
  FileUtils.mkdir_p(log_dir) unless File.directory?(log_dir)
22
- FileUtils.touch(securial_log) unless File.exist?(securial_log)
22
+ FileUtils.touch(securial_log)
23
23
  end
24
24
 
25
25
  def install_migrations
@@ -244,4 +244,13 @@ Securial.configure do |config|
244
244
  # the rate limit. The default is "Too many requests, please try again later."
245
245
  # This is only applied if `rate_limiting_enabled` is set to true.
246
246
  config.rate_limit_response_message = "Too many requests, please try again later."
247
- end
247
+
248
+ ## Set whether to enable other user profiles
249
+ # This allows users to view other users' profiles by their username.
250
+ # If this is set to true, users can access profiles of other users
251
+ # by visiting the URL `/profiles/:username`, where `:username` is the username
252
+ # of the user whose profile they want to view.
253
+ # If this is set to false, users can only view their own profile
254
+ # by visiting the URL `/accounts/me`.
255
+ config.enable_other_profiles = false
256
+ end
@@ -211,6 +211,7 @@ module Securial
211
211
  rate_limit_requests_per_minute: { type: Numeric, required: "rate_limiting_enabled", default: 60 },
212
212
  rate_limit_response_status: { type: Numeric, required: "rate_limiting_enabled", default: 429 },
213
213
  rate_limit_response_message: { type: String, required: "rate_limiting_enabled", default: "Too many requests, please try again later." },
214
+ enable_other_profiles: { type: [TrueClass, FalseClass], required: true, default: false },
214
215
  }
215
216
  end
216
217
  end
@@ -42,7 +42,7 @@ module Securial
42
42
  # @return [String, nil] The current default message for this error class
43
43
  #
44
44
  def self.default_message(message = nil)
45
- self._default_message = message if message
45
+ self._default_message = message
46
46
  self._default_message
47
47
  end
48
48
 
@@ -44,10 +44,7 @@ module Securial
44
44
  #
45
45
  # @example
46
46
  # middleware = TransformResponseKeys.new(app)
47
- #
48
- # @deprecated Use `Securial.configuration.response_keys_format` instead of format parameter
49
- #
50
- def initialize(app, format: :lowerCamelCase)
47
+ def initialize(app)
51
48
  @app = app
52
49
  end
53
50
 
@@ -6,5 +6,5 @@ module Securial
6
6
  #
7
7
  # @see https://semver.org/ Semantic Versioning 2.0.0
8
8
  # @return [String] the current version in the format "major.minor.patch"
9
- VERSION = "1.0.3".freeze
9
+ VERSION = "2.0.0".freeze
10
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: securial
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aly Badawy
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-27 00:00:00.000000000 Z
10
+ date: 2025-07-08 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -207,7 +207,7 @@ licenses:
207
207
  - MIT
208
208
  metadata:
209
209
  homepage_uri: https://github.com/AlyBadawy/Securial/wiki
210
- release_date: '2025-06-27'
210
+ release_date: '2025-07-08'
211
211
  allowed_push_host: https://rubygems.org
212
212
  source_code_uri: https://github.com/AlyBadawy/Securial
213
213
  documentation_uri: https://alybadawy.github.io/Securial/_index.html