View Source Eli.Admin (eli v0.1.13)

Documentation for Eli.

Summary

Functions

Confirms user's email.

Returns the current user data.

Refresh your token session returning a new session token.

Requests password recovery.

Signs user out closing and deleting session.

Checks whether the admin user is signed in or not.

Admin signs in any user without password.

Unlocks user for making the he/she able to sign in again.

Functions

Link to this function

confirm(confirmation_token)

View Source

Confirms user's email.

Examples

iex> Eli.confirm("Confirmation token")`

202
%{"data" => %{"message" => "account was successfully confirmed"}}

404
%{"errors" => %{"detail" => "Not Found"}}
Link to this function

current_user(session_token)

View Source

Returns the current user data.

Examples

iex> Eli.signed_in("JWT session token")
:signed_in

200
%{
  "data" => %{
    "active" => true,
    "email" => "user@mail.com",
    "id" => "732cf1c2-6299-41fa-8784-e458765743b7",
    "language" => "en",
    "name" => "User Name",
    "timezone" => "Europe/London"
  }
}

404
%{"errors" => %{"detail" => "Not Found"}},
Link to this function

recover_password(token, password, password_confirmation)

View Source

Recover password updating it.

Examples

iex> Eli.request_password_recovery("Confirmation token")

200
%{"data" => %{"message" => "password was successfully recovered"}}

400
%{"errors" => %{"detail" => "token is invalid"}}

400
%{"errors" => %{"detail" => "password has an invalid format"}}

400
%{"errors" => %{"detail" => "password and confirmation password are different"}}

Refresh your token session returning a new session token.

Examples

iex> Eli.refresh("JWT session token")

200
%{
  "data" => %{
    "token" => "JWT session token"
  }
}

404
%{"errors" => %{"detail" => "Not Found"}},
Link to this function

request_password_recovery(app_token, email)

View Source

Requests password recovery.

Examples

iex> Eli.request_password_recovery("Confirmation token")

200
%{"data" => %{"message" => "password recovery was successfully requested"}}

404
%{"errors" => %{"detail" => "Not Found"}}
Link to this function

sign_in(email, password)

View Source

Sign in.

Examples

iex> Eli.Admin.sign_in("user.email@domain.com", "seCr#t.passw0rd")
200
%{
  "data" => %{
    "token" => "JWT session token"
  }
}

400
%{"errors" => %{"detail" => "invalid credentials"}},

Signs user out closing and deleting session.

Examples

iex> Eli.sign_out("JWT session token")

200
%{"data" => %{"message" => "signed out successfully"}}

404
 %{"errors" => %{"detail" => "Not Found"}}
Link to this function

signed_in(session_token)

View Source

Checks whether the admin user is signed in or not.

Examples

iex> Eli.signed_in("JWT session token")
:signed_in

true

false
Link to this function

signs_in(session_token, user_data, app_id)

View Source

Admin signs in any user without password.

Examples

iex> Eli.Admin.signs_in(session_token, %{email: "user.email@domain.com", name: "User Name"}, app_id)
200
%{
  "data" => %{
    "user" => %{
      "active" => true,
      "email" => "
      ...
  }
}

400
%{"errors" => %{"detail" => "invalid credentials"}},

Unlocks user for making the he/she able to sign in again.

Examples

iex> Eli.unlock("Unlock token")

202
%{"data" => %{"message" => "account was successfully unlocked"}}

404
%{"errors" => %{"detail" => "Not Found"}}