Auth.Person (auth v1.6.6)
Defines Person schema and CRUD functions
Link to this section Summary
Functions
Default attributes validation for Person
decrypt_email/1
accepts a cyphertext
and attempts to Base58.decode
followed by AES.decrypt it. If decode or decrypt fails, return 0 (zero).
Deletes a person.
get_person_by_email/1
returns the person based on email address.
transform_github_profile_data_to_person/1
transforms the profile data
received from invoking ElixirAuthGithub.github_auth/1
into a person
record that can be inserted into the people table.
transform_profile_data_to_person/1
transforms the profile data
received from invoking ElixirAuthGoogle.get_user_profile/1
into a person
record that can be inserted into the people table.
upsert_person/1
inserts or updates a person record.
Link to this section Functions
changeset(person, attrs)
Default attributes validation for Person
create_github_person(profile)
create_google_person(profile)
create_person(person)
decrypt(ciphertext)
decrypt_email(cyphertext)
decrypt_email/1
accepts a cyphertext
and attempts to Base58.decode
followed by AES.decrypt it. If decode or decrypt fails, return 0 (zero).
delete(person)
Deletes a person.
examples
Examples
iex> delete(person)
{:ok, %Role{}}
iex> delete(person)
{:error, %Ecto.Changeset{}}
get_list_of_people()
get_person_by_email(email)
get_person_by_email/1
returns the person based on email address.
get_person_by_id(id)
get_status_verified()
login_register_changeset(attrs)
password_new_changeset(attrs)
put_email_status_verified(changeset)
transform_github_profile_data_to_person(profile)
transform_github_profile_data_to_person/1
transforms the profile data
received from invoking ElixirAuthGithub.github_auth/1
into a person
record that can be inserted into the people table.
example
Example
iex> transform_profile_data_to_person(%{
avatar_url: "https://avatars3.githubusercontent.com/u/194400?v=4",
email: "alex@gmail.com",
followers: 2846,
login: "alex",
name: "Alex McAwesome",
type: "User",
url: "https://api.github.com/users/alex"
}) %{
"email" => "nelson@gmail.com",
"picture" => "https://avatars3.githubusercontent.com/u/194400?v=4",
"status" => 1,
"givenName" => "Alex McAwesome"
}
transform_google_profile_data_to_person(profile)
transform_profile_data_to_person/1
transforms the profile data
received from invoking ElixirAuthGoogle.get_user_profile/1
into a person
record that can be inserted into the people table.
example
Example
iex> transform_profile_data_to_person(%{
"email" => "nelson@gmail.com",
"email_verified" => true,
"family_name" => "Correia",
"given_name" => "Nelson",
"locale" => "en",
"name" => "Nelson Correia",
"picture" => "https://lh3.googleusercontent.com/a-/AAuE7mApnYb260YC1JY7a",
"sub" => "940732358705212133793"
}) %{
"email" => "nelson@gmail.com",
"email_verified" => true,
"family_name" => "Correia",
"given_name" => "Nelson",
"locale" => "en",
"name" => "Nelson Correia",
"picture" => "https://lh3.googleusercontent.com/a-/AAuE7mApnYb260YC1JY7a",
"sub" => "940732358705212133793"
"status" => 1,
"familyName" => "Correia",
"givenName" => "Nelson"
}
upsert_person(person)
upsert_person/1
inserts or updates a person record.