Skip to content

Commit

Permalink
render DWYL_API_KEY from client_id and client_secret #42
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Apr 26, 2020
1 parent 61f812b commit 36f87d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
8 changes: 2 additions & 6 deletions lib/auth_web/controllers/apikey_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ defmodule AuthWeb.ApikeyController do
def create(conn, %{"apikey" => apikey_params}) do
IO.inspect(apikey_params, label: "apikey_params")
person_id = conn.assigns.decoded.id
secret = Fields.AES.encrypt(person_id) |> Base58.encode
|> IO.inspect(label: "secret")

client = Fields.AES.encrypt(person_id) |> Base58.encode
|> IO.inspect(label: "client")
params = Map.merge(apikey_params, %{
"client_secret" => secret,
"client_id" => client,
"client_secret" => encrypt_encode(person_id),
"client_id" => encrypt_encode(person_id),
"person_id" => person_id
})
case Apikey.create_apikey(params) do
Expand Down
11 changes: 5 additions & 6 deletions lib/auth_web/templates/apikey/show.html.eex
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<h1>Show Apikey</h1>
<h1>Your DWYL_API_KEY</h1>

<div>
<p>
<strong>DWYL_API_KEY:</strong>
<div style="width:420px; font-size: 1.2em;
<div style="width:470px; font-size: 1.2em;
overflow-wrap: break-word; font-family: monospace;
border: 1px solid black; padding: 10px; background-color: #EBEDEF;">
<%= @apikey.client_id %><%= @apikey.client_secret %>
<%= @apikey.client_id %>/<%= @apikey.client_secret %>
</div>
</p>

<p>
<strong>Name:</strong>
<strong>Key Name:</strong>
<%= @apikey.name %>
</p>

Expand All @@ -21,7 +20,7 @@
</p>

<p>
<strong>Url:</strong>
<strong>URL:</strong>
<%= @apikey.url %>
</p>

Expand Down

0 comments on commit 36f87d4

Please sign in to comment.