blob: 28db29c4ff9d7d30a996aa79e213c1dc1a590f2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
defmodule Recaptcha.Template do
@moduledoc """
Responsible for rendering boilerplate recaptcha HTML code, supports noscript fallback.
[Some](https://developers.google.com/recaptcha/docs/display#explicit_render)
functionality is not currently supported.
In future this module may be separated out into a Phoenix specific library.
"""
require Elixir.EEx
EEx.function_from_file :defp, :render_template, "lib/template.html.eex", [:assigns]
@public_key Application.get_env(:recaptcha, :public_key)
@doc """
Returns a string with reCAPTCHA code
To convert the string to html code, use Phoenix.HTML.Raw/1 method
"""
def display(options \\ []) do
public_key = options[:public_key] || @public_key
render_template(public_key: public_key, options: options)
end
end
|