You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

369 lines
13 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.23.0">
<meta name="project" content="Mirage v0.75.0">
<meta name="author" content="Inhji">
<title>Mirage.Accounts.User — Mirage v0.75.0</title>
<link rel="stylesheet" href="dist/elixir-9f91ebe876dc01d67920.css" />
<script src="dist/sidebar_items-86ebe4f0ec.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/app-60a0c9f10e9e52eae31f.js"></script>
</head>
<body data-type="modules">
<script>try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { }</script>
<div class="main">
<button class="sidebar-button sidebar-toggle">
<span class="icon-menu" title="Collapse/expand sidebar"></span>
</button>
<section class="sidebar">
<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button" aria-label="Submit Search">
<span class="icon-search" aria-hidden="true" title="Submit search"></span>
</button>
<button type="button" tabindex="-1" class="search-close-button" aria-label="Cancel Search">
<span class="icon-cross" aria-hidden="true" title="Cancel search"></span>
</button>
<label class="search-label">
<input name="q" type="text" id="search-list" class="search-input" placeholder="Search..." aria-label="Input your search terms" autocomplete="off" />
</label>
</form>
<div class="autocomplete">
<div class="autocomplete-results">
</div>
</div>
<div class="sidebar-header">
<div class="sidebar-projectDetails">
<a href="https://git.inhji.de/inhji/mirage" class="sidebar-projectName">
Mirage
</a>
<strong class="sidebar-projectVersion">
v0.75.0
</strong>
</div>
</div>
<ul class="sidebar-listNav">
<li><a id="extras-list" href="#full-list">Pages</a></li>
<li><a id="modules-list" href="#full-list">Modules</a></li>
</ul>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>
<section class="content">
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
Mirage.Accounts.User <small class="app-vsn">(Mirage v0.75.0)</small>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L1" title="View Source" class="view-source" rel="help">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</h1>
<section id="summary" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#summary">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this section</span>
</a>
Summary
</h1>
<div class="summary-functions summary">
<h2>
<a href="#functions">Functions</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#confirm_changeset/1">confirm_changeset(user)</a>
</div>
<div class="summary-synopsis"><p>Confirms the account by setting <code class="inline">confirmed_at</code>.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#email_changeset/2">email_changeset(user, attrs)</a>
</div>
<div class="summary-synopsis"><p>A user changeset for changing the email.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#password_changeset/3">password_changeset(user, attrs, opts \\ [])</a>
</div>
<div class="summary-synopsis"><p>A user changeset for changing the password.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#registration_changeset/3">registration_changeset(user, attrs, opts \\ [])</a>
</div>
<div class="summary-synopsis"><p>A user changeset for registration.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#valid_password?/2">valid_password?(arg1, password)</a>
</div>
<div class="summary-synopsis"><p>Verifies the password.</p></div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#validate_current_password/2">validate_current_password(changeset, password)</a>
</div>
<div class="summary-synopsis"><p>Validates the current password otherwise adds an error to the changeset.</p></div>
</div>
</div>
</section>
<section id="functions" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#functions">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this section</span>
</a>
Functions
</h1>
<div class="functions-list">
<section class="detail" id="confirm_changeset/1">
<div class="detail-header">
<a href="#confirm_changeset/1" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">confirm_changeset(user)</h1>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L108" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Confirms the account by setting <code class="inline">confirmed_at</code>.</p>
</section>
</section>
<section class="detail" id="email_changeset/2">
<div class="detail-header">
<a href="#email_changeset/2" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">email_changeset(user, attrs)</h1>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L76" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>A user changeset for changing the email.</p><p>It requires the email to change otherwise an error is added.</p>
</section>
</section>
<section class="detail" id="password_changeset/3">
<span id="password_changeset/2"></span>
<div class="detail-header">
<a href="#password_changeset/3" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">password_changeset(user, attrs, opts \\ [])</h1>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L98" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>A user changeset for changing the password.</p><h2 id="password_changeset/3-options" class="section-heading">
<a href="#password_changeset/3-options" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
Options
</h2>
<ul><li><code class="inline">:hash_password</code> - Hashes the password so it can be stored securely
in the database and ensures the password field is cleared to prevent
leaks in the logs. If password hashing is not needed and clearing the
password field is not desired (like when using this changeset for
validations on a LiveView form), this option can be set to <code class="inline">false</code>.
Defaults to <code class="inline">true</code>.</li></ul>
</section>
</section>
<section class="detail" id="registration_changeset/3">
<span id="registration_changeset/2"></span>
<div class="detail-header">
<a href="#registration_changeset/3" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">registration_changeset(user, attrs, opts \\ [])</h1>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L32" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>A user changeset for registration.</p><p>It is important to validate the length of both email and password.
Otherwise databases may truncate the email without warnings, which
could lead to unpredictable or insecure behaviour. Long passwords may
also be very expensive to hash for certain algorithms.</p><h2 id="registration_changeset/3-options" class="section-heading">
<a href="#registration_changeset/3-options" class="hover-link"><span class="icon-link" aria-hidden="true"></span></a>
Options
</h2>
<ul><li><code class="inline">:hash_password</code> - Hashes the password so it can be stored securely
in the database and ensures the password field is cleared to prevent
leaks in the logs. If password hashing is not needed and clearing the
password field is not desired (like when using this changeset for
validations on a LiveView form), this option can be set to <code class="inline">false</code>.
Defaults to <code class="inline">true</code>.</li></ul>
</section>
</section>
<section class="detail" id="valid_password?/2">
<div class="detail-header">
<a href="#valid_password?/2" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">valid_password?(arg1, password)</h1>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L119" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Verifies the password.</p><p>If there is no user or the user doesn't have a password, we call
<a href="https://hexdocs.pm/bcrypt_elixir/2.3.0/Bcrypt.html#no_user_verify/0"><code class="inline">Bcrypt.no_user_verify/0</code></a> to avoid timing attacks.</p>
</section>
</section>
<section class="detail" id="validate_current_password/2">
<div class="detail-header">
<a href="#validate_current_password/2" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature">validate_current_password(changeset, password)</h1>
<a href="https://git.inhji.de/inhji/mirage/src/branch/main/lib/mirage/accounts/user.ex#L132" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<p>Validates the current password otherwise adds an error to the changeset.</p>
</section>
</section>
</div>
</section>
<footer class="footer">
<p>
<span class="line">
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener">ExDoc</a> (v0.23.0) for the
<a href="https://elixir-lang.org" title="Elixir" target="_blank">Elixir programming language</a>.
</span>
<span class="line">
Designed by
<a href="https://twitter.com/dignifiedquire" target="_blank" rel="noopener" title="@dignifiedquire">Friedel Ziegelmayer</a>.
</span>
</p>
<p>
<a href="api-reference.html" title="API reference" class="line footer-button">API Reference</a>
<button class="line footer-button display-shortcuts-help">
Display keyboard shortcuts
</button>
<button class="line footer-button night-mode-toggle">
Toggle night mode
</button>
<button class="line footer-button display-quick-switch">
Go to a HexDocs package
</button>
<button class="line footer-button tooltips-toggle">
<span class="tooltips-option-disable">Disable tooltips</span>
<span class="tooltips-option-enable">Enable tooltips</span>
</button>
</p>
</footer>
</div>
</div>
</section>
</div>
</body>
</html>