Compare commits
4 Commits
9f6fa6deba
...
534e5a9d3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
534e5a9d3c
|
|||
|
1b72c97f42
|
|||
|
bfd8ca16a9
|
|||
|
64de4deddd
|
@@ -1,9 +1,9 @@
|
||||
class WebKeyDirectoryController < WellKnownController
|
||||
before_action :allow_cross_origin_requests, only: [ :show ]
|
||||
before_action :allow_cross_origin_requests
|
||||
|
||||
# /.well-known/openpgpkey/hu/:hashed_username(.txt)
|
||||
def show
|
||||
@user = User.find_by(cn: params[:l])
|
||||
@user = User.find_by(cn: params[:l].downcase)
|
||||
|
||||
if @user.nil? ||
|
||||
@user.pgp_pubkey.empty? ||
|
||||
@@ -28,7 +28,4 @@ class WebKeyDirectoryController < WellKnownController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
end
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
<td>XMPP (ejabberd)</td>
|
||||
<td>
|
||||
<%= render FormElements::ToggleComponent.new(
|
||||
enabled: @services_enabled.include?("xmpp"),
|
||||
enabled: @services_enabled.include?("ejabberd"),
|
||||
input_enabled: false
|
||||
) %>
|
||||
</td>
|
||||
|
||||
@@ -64,6 +64,15 @@ RSpec.describe "OpenPGP Web Key Directory", type: :request do
|
||||
expect(response.body).to eq(expected_binary_data)
|
||||
end
|
||||
|
||||
context "with wrong capitalization of username" do
|
||||
it "returns the pubkey as ASCII Armor plain text" do
|
||||
get "/.well-known/openpgpkey/hu/yuca4ky39mhwkjo78qb8zjgbfj1hg3yf?l=JimmY"
|
||||
expect(response).to have_http_status(:ok)
|
||||
expected_binary_data = File.binread("#{Rails.root}/spec/fixtures/files/pgp_key_valid_jimmy.pem")
|
||||
expect(response.body).to eq(expected_binary_data)
|
||||
end
|
||||
end
|
||||
|
||||
context "with .txt extension" do
|
||||
it "returns the pubkey as ASCII Armor plain text" do
|
||||
get "/.well-known/openpgpkey/hu/yuca4ky39mhwkjo78qb8zjgbfj1hg3yf.txt?l=jimmy"
|
||||
|
||||
Reference in New Issue
Block a user