securial 1.1.0 → 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 +4 -4
- data/app/controllers/securial/accounts_controller.rb +10 -2
- data/config/routes.rb +4 -1
- data/lib/generators/securial/install/install_generator.rb +1 -1
- data/lib/generators/securial/install/templates/securial_initializer.erb +10 -1
- data/lib/securial/config/signature.rb +1 -0
- data/lib/securial/error/base_securial_error.rb +1 -1
- data/lib/securial/middleware/transform_response_keys.rb +1 -4
- data/lib/securial/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cd71b4330338b3487c337e3345a294c964c21b7ac34e3e5092ebb53e09db858
|
4
|
+
data.tar.gz: 8869be54802c27b6f31ec6ea4cd3e8c1c304014617e35195d6864c748a4cadde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
34
|
-
|
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
|
@@ -19,7 +19,7 @@ module Securial
|
|
19
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)
|
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
|
-
|
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
|
@@ -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
|
|
data/lib/securial/version.rb
CHANGED