-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
defmodule PhilomenaWeb.PchController do | ||
use PhilomenaWeb, :controller | ||
|
||
alias Philomena.ArtistLinks.BadgeAwarder | ||
|
||
def index(conn, _params) do | ||
render(conn, title: "PCH Secret") | ||
end | ||
|
||
def create(conn, %{"event" => event_params}) do | ||
user = conn.assigns.current_user | ||
secret = event_secret() | ||
|
||
case event_params do | ||
%{"passphrase" => ^secret} -> | ||
{:ok, _badge} = BadgeAwarder.award_badge(user, user, "PonyCon Holland") | ||
|
||
conn | ||
|> put_flash(:info, "Verification granted.") | ||
|> redirect(to: ~p"/") | ||
|
||
_ -> | ||
conn | ||
|> put_flash(:error, "Incorrect passphrase.") | ||
|> redirect(to: ~p"/") | ||
end | ||
end | ||
|
||
defp event_secret do | ||
Application.fetch_env!(:philomena, :event_secret) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
h1 Enter passphrase for verification | ||
|
||
= form_for :event, ~p"/pch", fn f -> | ||
.field | ||
= text_input f, :passphrase, class: "input", placeholder: "Passphrase", required: true | ||
|
||
.field | ||
= submit "Submit", class: "button" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
defmodule PhilomenaWeb.PchView do | ||
use PhilomenaWeb, :view | ||
end |