SmsUp.Pin.Store (sms_up v1.0.2) View Source
This module stores random pin associated with an id to be checked later.
Default validity is 10 minutes and is configurable:
config :sms_up, pin_validity: 15
Default token size is 6 and can be modified also:
config :sms_up, :pin_size, 4
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Generate a pin code for the given id and store it in a mnesia database. Returns the generated pin code.
Validate a pin code along with the user id and tells if the provided pin is correct or not. Returns a tupple containing true or false regarding the result.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
Generate a pin code for the given id and store it in a mnesia database. Returns the generated pin code.
Examples
iex> SmsUp.Pin.Store.store("user@email.ch")
"123456"
Specs
Validate a pin code along with the user id and tells if the provided pin is correct or not. Returns a tupple containing true or false regarding the result.
Examples
iex> SmsUp.Pin.Store.validate("user@email.ch", "Good Pin")
{:ok, true}
iex> SmsUp.Pin.Store.validate("user@email.ch", "Wrong Pin")
{:ok, false}