refactor(auth): use heex templates

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2021-10-07 05:58:00 +05:30
1 parent 2ddccce85d
commit 8f4672b516
13 files changed
+54 -34

No files matched your search

+8 -3
View File
@@ -13,14 +13,19 @@ defmodule Ketbin.Pastes.Utils do
def generate_key(length \\ 10) do
random = Enum.random([0, 1])
Enum.map(0..length, fn i -> if Integer.mod(i, 2) == random, do: rand_consonant(), else: rand_vowel() end)
|> List.to_string
Enum.map(0..length, fn i ->
if Integer.mod(i, 2) == random, do: rand_consonant(), else: rand_vowel()
end)
|> List.to_string()
end
def is_url?(url) do
try do
uri = URI.parse(url)
uri.scheme != nil && uri.host =~ "." && Enum.member?(["https", "http", "mailto"], uri.scheme) && !(uri.host =~ "katb.in")
uri.scheme != nil && uri.host =~ "." &&
Enum.member?(["https", "http", "mailto"], uri.scheme) && !(uri.host =~ "katb.in")
rescue
FunctionClauseError -> false
end