Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

little things: set default expiration time for login token to 24 hours, run migration automatically #6

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/nopass.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ defmodule Nopass do
Parameters:
`one_time_password`: the one-time password to verify and consume.
`opts`: optional options, including:
`expires`_after_seconds: the lifetime of the generated login token, in seconds, after which the login token expires. Optional, default: 86400 (one day)
`expires_after_seconds: the lifetime of the generated login token, in seconds, after which the login token expires. Optional, default: 86400 (one day)
`length`: the length of the random portion of the login token to be generated. Optional, default: 50
'login_token_identity': the value of the identity to be associated with the login token or the function for computing it, based on the value of the one-time-password's identity. Optional, default: the identity associated with the one-time password.

Expand All @@ -85,7 +85,7 @@ defmodule Nopass do
login_token_params =
Enum.into(opts, %{
login_token_identity: fn otp_identity -> otp_identity end,
expires_after_seconds: 600,
expires_after_seconds: 60 * 60 * 24,
length: 50
})

Expand Down
3 changes: 2 additions & 1 deletion lib/nopass/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ defmodule Nopass.Application do
@impl true
def start(_type, _args) do
children = [
Nopass.Repo
Nopass.Repo,
{Ecto.Migrator, repos: [Nopass.Repo]}
# Starts a worker by calling: Nopass.Worker.start_link(arg)
# {Nopass.Worker, arg}
]
Expand Down
Loading