-
Notifications
You must be signed in to change notification settings - Fork 0
/
amelinium.model.confirmation.html
39 lines (39 loc) · 42.9 KB
/
amelinium.model.confirmation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>amelinium.model.confirmation documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Amelinium</span> <span class="project-version">1.0.1</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li><li class="depth-1 "><a href="20_hypermedia.html"><div class="inner"><span>Hypermedia-driven</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><a href="amelinium.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>amelinium</span></div></a></li><li class="depth-2 branch"><a href="amelinium.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-2"><a href="amelinium.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-3"><a href="amelinium.api.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4"><a href="amelinium.api.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3"><a href="amelinium.api.url.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>url</span></div></a></li><li class="depth-2 branch"><a href="amelinium.app.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>app</span></div></a></li><li class="depth-2"><a href="amelinium.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>algo</span></div></div></li><li class="depth-4 branch"><a href="amelinium.auth.algo.append.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>append</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.fail.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fail</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.pbkdf2.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pbkdf2</span></div></a></li><li class="depth-4"><a href="amelinium.auth.algo.scrypt.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scrypt</span></div></a></li><li class="depth-3 branch"><a href="amelinium.auth.pwd.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>pwd</span></div></a></li><li class="depth-3"><a href="amelinium.auth.specs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specs</span></div></a></li><li class="depth-2"><a href="amelinium.common.html"><div class="inner"><span class="tree" style="top: -238px;"><span class="top" style="height: 247px;"></span><span class="bottom"></span></span><span>common</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-3"><a href="amelinium.common.oplog.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oplog</span></div></a></li><li class="depth-4"><a href="amelinium.common.oplog.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.populators.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-3"><a href="amelinium.common.swagger.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>swagger</span></div></a></li><li class="depth-2 branch"><a href="amelinium.core.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="amelinium.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3"><a href="amelinium.db.sql.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sql</span></div></a></li><li class="depth-2 branch"><a href="amelinium.errors.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-2"><a href="amelinium.http.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>client</span></div></div></li><li class="depth-4"><a href="amelinium.http.client.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.handler.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>handler</span></div></a></li><li class="depth-3"><a href="amelinium.http.middleware.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>middleware</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.coercion.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>coercion</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.content.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>content</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.debug.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>debug</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>format</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.headers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>headers</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.language.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>language</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.lazy-req.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>lazy-req</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.populators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.remote-ip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>remote-ip</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.roles.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>roles</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-4"><a href="amelinium.http.middleware.validators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>validators</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.router.html"><div class="inner"><span class="tree" style="top: -424px;"><span class="top" style="height: 433px;"></span><span class="bottom"></span></span><span>router</span></div></a></li><li class="depth-3"><a href="amelinium.http.server.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.server.jetty.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jetty</span></div></a></li><li class="depth-4"><a href="amelinium.http.server.undertow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>undertow</span></div></a></li><li class="depth-2"><a href="amelinium.i18n.html"><div class="inner"><span class="tree" style="top: -672px;"><span class="top" style="height: 681px;"></span><span class="bottom"></span></span><span>i18n</span></div></a></li><li class="depth-3"><a href="amelinium.i18n.pluralizers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pluralizers</span></div></a></li><li class="depth-2 branch"><a href="amelinium.identity.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-2 branch"><a href="amelinium.locale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locale</span></div></a></li><li class="depth-2 branch"><a href="amelinium.logging.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logging</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>model</span></div></div></li><li class="depth-3 branch current"><a href="amelinium.model.confirmation.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>confirmation</span></div></a></li><li class="depth-3"><a href="amelinium.model.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>proto</span></div></div></li><li class="depth-3 branch"><a href="amelinium.proto.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.proto.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.schemas.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>schemas</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></div></li><li class="depth-3"><a href="amelinium.server.ssl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ssl</span></div></a></li><li class="depth-2 branch"><a href="amelinium.system.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>system</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></div></li><li class="depth-3 branch"><a href="amelinium.types.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.types.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.utils.html"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="amelinium.web.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>web</span></div></a></li><li class="depth-3"><a href="amelinium.web.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4 branch"><a href="amelinium.web.controller.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-4"><a href="amelinium.web.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.js.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>js</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.taggers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>taggers</span></div></a></li><li class="depth-3"><a href="amelinium.web.url.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>url</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="amelinium.model.confirmation.html#var-code-to-token"><div class="inner"><span>code-to-token</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-confirm-code-query"><div class="inner"><span>confirm-code-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-confirm-token-query"><div class="inner"><span>confirm-token-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-create"><div class="inner"><span>create</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-create-for-change"><div class="inner"><span>create-for-change</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-create-for-recovery"><div class="inner"><span>create-for-recovery</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-create-for-registration"><div class="inner"><span>create-for-registration</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-decrease-attempts-query"><div class="inner"><span>decrease-attempts-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-delete"><div class="inner"><span>delete</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-establish"><div class="inner"><span>establish</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-gen-code"><div class="inner"><span>gen-code</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-gen-confirmation-query"><div class="inner"><span>gen-confirmation-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-gen-full-confirmation-query"><div class="inner"><span>gen-full-confirmation-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-gen-report-errors-query"><div class="inner"><span>gen-report-errors-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-gen-token"><div class="inner"><span>gen-token</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-make-qtoken"><div class="inner"><span>make-qtoken</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-make-qtoken-all"><div class="inner"><span>make-qtoken-all</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-make-qtoken-some"><div class="inner"><span>make-qtoken-some</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-qtoken-matches.3F"><div class="inner"><span>qtoken-matches?</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-registration-confirmation-query"><div class="inner"><span>registration-confirmation-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-report-errors"><div class="inner"><span>report-errors</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-report-errors-code-query"><div class="inner"><span>report-errors-code-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-report-errors-id-query"><div class="inner"><span>report-errors-id-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-report-errors-simple-id-query"><div class="inner"><span>report-errors-simple-id-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-report-errors-token-query"><div class="inner"><span>report-errors-token-query</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-retry-email"><div class="inner"><span>retry-email</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-retry-phone"><div class="inner"><span>retry-phone</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-specific-id"><div class="inner"><span>specific-id</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-status"><div class="inner"><span>status</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-update-request-id"><div class="inner"><span>update-request-id</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-verify-bad-code-set"><div class="inner"><span>verify-bad-code-set</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-verify-bad-id-set"><div class="inner"><span>verify-bad-id-set</span></div></a></li><li class="depth-1"><a href="amelinium.model.confirmation.html#var-verify-bad-token-set"><div class="inner"><span>verify-bad-token-set</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">amelinium.model.confirmation</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>amelinium service, confirmation model.</p>
</div></div><div class="public anchor" id="var-code-to-token"><h3>code-to-token</h3><div class="usage"><code>(code-to-token db id code)</code></div><div class="doc"><div class="markdown"><p>Returns a confirmation token associated with the given confirmation code and identity. Additionally, returns confirmation status.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L522">view source</a></div></div><div class="public anchor" id="var-confirm-code-query"><h3>confirm-code-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L545">view source</a></div></div><div class="public anchor" id="var-confirm-token-query"><h3>confirm-token-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L535">view source</a></div></div><div class="public anchor" id="var-create"><h3>create</h3><div class="usage"><code>(create db id user-id exp attempts user-required? reason)</code><code>(create db id user-id exp attempts id-type user-required? reason)</code></div><div class="doc"><div class="markdown"><p>Creates a confirmation code for an existing user identified by the given user ID (<code>user-id</code>). The identity to be confirmed (<code>id</code>) can be an e-mail address (<code>:email</code>), a phone number (<code>:phone</code>) or any supported value.</p>
<p>When the confirmation was already generated and it hasn’t expired, it is returned with an existing code and token.</p>
<p>When the given e-mail is already assigned to some other registered user the returned map will contain 4 keys: <code>:exists?</code> set to <code>true</code>, <code>:existing-user/id</code> set to ID of existing user, <code>:id</code> set to the given e-mail (as a string) and <code>:reason</code> set to the given reason (as a keyword, or <code>nil</code> if not given).</p>
<p>Attempts counter is increased each time this function is called.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L380">view source</a></div></div><div class="public anchor" id="var-create-for-change"><h3>create-for-change</h3><div class="usage"><code>(create-for-change db id user-id exp attempts)</code><code>(create-for-change db id user-id exp attempts id-type)</code></div><div class="doc"><div class="markdown"><p>Creates a confirmation code for an existing user identified by the given user ID (<code>user-id</code>). The identity to be confirmed (<code>id</code>) can be an e-mail address (<code>:email</code>), a phone number (<code>:phone</code>) or any supported value.</p>
<p>When the confirmation was already generated and it hasn’t expired, it is returned with an existing code and token.</p>
<p>When the given e-mail is already assigned to some other registered user the returned map will contain 4 keys: <code>:exists?</code> set to <code>true</code>, <code>:existing-user/id</code> set to ID of existing user, <code>:id</code> set to the given e-mail (as a string) and <code>:reason</code> set to the given reason (as a keyword, or <code>nil</code> if not given).</p>
<p>Attempts counter is increased each time this function is called.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L401">view source</a></div></div><div class="public anchor" id="var-create-for-recovery"><h3>create-for-recovery</h3><div class="usage"><code>(create-for-recovery db id user-id exp attempts)</code><code>(create-for-recovery db id user-id exp attempts id-type)</code></div><div class="doc"><div class="markdown"><p>Creates a recovery code for an existing user identified by the given user ID (<code>user-id</code>). The identity to be confirmed (<code>id</code>) can be an e-mail address (<code>:email</code>), a phone number (<code>:phone</code>) or any supported value.</p>
<p>When the confirmation was already generated and it hasn’t expired, it is returned with an existing code and token.</p>
<p>When the given e-mail is assigned to the given user the returned map will contain 4 keys: <code>:exists?</code> set to <code>true</code>, <code>:existing-user/id</code> set to ID of existing user, <code>:id</code> set to the given e-mail (as a string) and <code>:reason</code> set to the given reason (as a keyword, or <code>nil</code> if not given).</p>
<p>Attempts counter is increased each time this function is called.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L420">view source</a></div></div><div class="public anchor" id="var-create-for-registration"><h3>create-for-registration</h3><div class="usage"><code>(create-for-registration udata)</code><code>(create-for-registration db udata)</code><code>(create-for-registration db udata reason)</code></div><div class="doc"><div class="markdown"><p>Creates a confirmation code for a new user identified by the given e-mail address.</p>
<p>When the confirmation was already generated and it hasn’t expired, it is returned with an existing code and token.</p>
<p>When the given e-mail is already assigned to a registered user the returned map will contain 4 keys: <code>:exists?</code> set to <code>true</code>, <code>:existing-user/id</code> set to ID of existing user, <code>:id</code> set to the given e-mail (as a string) and <code>:reason</code> set to the given reason (as a keyword, or <code>nil</code> if not given).</p>
<p>Attempts counter is increased each time this function is called.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L348">view source</a></div></div><div class="public anchor" id="var-decrease-attempts-query"><h3>decrease-attempts-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L628">view source</a></div></div><div class="public anchor" id="var-delete"><h3>delete</h3><div class="usage"><code>(delete db id)</code><code>(delete db id reason)</code></div><div class="doc"><div class="markdown"><p>Deletes confirmation of identity <code>id</code> from a database.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L181">view source</a></div></div><div class="public anchor" id="var-establish"><h3>establish</h3><div class="usage"><code>(establish db id code exp-minutes reason)</code><code>(establish db id code token exp-minutes reason)</code><code>(establish db token exp-minutes reason)</code></div><div class="doc"><div class="markdown"><p>Confirms an identity (<code>id</code>), which may be an e-mail or a phone number, using a token or an identifier with a code. If the verification is successful, sets <code>confirmed</code> flag to <code>TRUE</code> (1) in a database which prevents from further confirmations and marks identity as confirmed for other operations. The <code>exp-minutes</code> argument should be a positive integer and will be used to increase expiration time by the given amount of minutes. This is to ensure that the next operation, if any, which may take some time, will succeed. The <code>reason</code> argument is the confirmation reason and should match the reason given during the generation of a token or code.</p>
<p>Returns a map with <code>:confirmed?</code> set to <code>true</code> if the given token or code was verified. Returns a map with <code>:confirmed?</code> set to <code>false</code> and <code>:error</code> set to a keyword describing the cause if the token or code was not verified. Returns <code>nil</code> if something went wrong during the interaction with a database or when the required input parameters were empty.</p>
<p>The <code>:user/id</code> key of a result, if exists, contains numeric user identifier of a requester (the user for whom the verification was initiated).</p>
<p>If the identity is already confirmed and there is no error (i.e. confirmation has not yet expired), it will also return a map with <code>:confirmed?</code> set to <code>true</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L555">view source</a></div></div><div class="public anchor" id="var-gen-code"><h3>gen-code</h3><div class="usage"><code>(gen-code)</code></div><div class="doc"><div class="markdown"><p>Generates pseudo-random, 7-digits confirmation code. Returns a number.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L105">view source</a></div></div><div class="public anchor" id="var-gen-confirmation-query"><h3>gen-confirmation-query</h3><div class="usage"><code>(gen-confirmation-query identity-type user-required?)</code></div><div class="doc"><div class="markdown"><p>Generates a confirmation query for an e-mail or a phone UPDATED by an existing user or used in other process (like password recovery).</p>
<p>Note: it may return a query giving an empty result set if there is no requesting user in a database.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L234">view source</a></div></div><div class="public anchor" id="var-gen-full-confirmation-query"><h3>gen-full-confirmation-query</h3><div class="usage"><code>(gen-full-confirmation-query identity-type)</code></div><div class="doc"><div class="markdown"><p>Generates a confirmation query for an e-mail or a phone used during registration of a NEW USER account.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L198">view source</a></div></div><div class="public anchor" id="var-gen-report-errors-query"><h3>gen-report-errors-query</h3><div class="usage"><code>(gen-report-errors-query where)</code></div><div class="doc"><div class="markdown"><p>Generates SQL query for reporting errors found during confirmation process. When executed the query returns a map with boolean values and the following keys: <code>:confirmed</code> (already confirmed), <code>:attempts</code> (attempts exceeded), <code>:reason</code> (reason for the given token or code is different from the reason for which the confirmation had been created for), <code>:expires</code> (confirmation expired), <code>:present</code> (an e-mail or a phone number is already assigned to an existing user).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L439">view source</a></div></div><div class="public anchor" id="var-gen-token"><h3>gen-token</h3><div class="usage"><code>(gen-token)</code></div><div class="doc"><div class="markdown"><p>Generates random confirmation token. Returns a string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L114">view source</a></div></div><div class="public anchor" id="var-make-qtoken"><h3>make-qtoken</h3><div class="usage"><code>(make-qtoken x)</code><code>(make-qtoken x y)</code><code>(make-qtoken x y z)</code><code>(make-qtoken x y z & more)</code></div><div class="doc"><div class="markdown"><p>Generates a quick token on a basis of a string representation of the given argument(s). Returns a string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L119">view source</a></div></div><div class="public anchor" id="var-make-qtoken-all"><h3>make-qtoken-all</h3><div class="usage"><code>(make-qtoken-all x)</code><code>(make-qtoken-all x y)</code><code>(make-qtoken-all x y z)</code><code>(make-qtoken-all x y z & more)</code></div><div class="doc"><div class="markdown"><p>Generates a quick token on a basis of a string representation of the given argument(s) which all must not be an empty strings nor <code>nil</code> values. Returns a string or <code>nil</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L143">view source</a></div></div><div class="public anchor" id="var-make-qtoken-some"><h3>make-qtoken-some</h3><div class="usage"><code>(make-qtoken-some x)</code><code>(make-qtoken-some x y)</code><code>(make-qtoken-some x y z)</code><code>(make-qtoken-some x y z & more)</code></div><div class="doc"><div class="markdown"><p>Generates a quick token on a basis of a string representation of the given argument(s) which combined may not be an empty string. Returns a string or <code>nil</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L131">view source</a></div></div><div class="public anchor" id="var-qtoken-matches.3F"><h3>qtoken-matches?</h3><div class="usage"><code>(qtoken-matches? qtoken)</code><code>(qtoken-matches? qtoken a)</code><code>(qtoken-matches? qtoken a b)</code><code>(qtoken-matches? qtoken a b c)</code><code>(qtoken-matches? qtoken a b c d)</code><code>(qtoken-matches? qtoken a b c d & more)</code></div><div class="doc"><div class="markdown"><p>Checks if a quick token <code>qtoken</code> matches the result of applying <code>make-qtoken</code> to all other arguments which cannot be an empty string after concatenation. If combined arguments are empty, <code>nil</code> or <code>false</code>, returns <code>false</code>. If <code>qtoken</code> is falsy or an empty string, returns <code>false</code> too. If <code>qtoken</code> matches the calculated quick token, returns <code>true</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L166">view source</a></div></div><div class="public anchor" id="var-registration-confirmation-query"><h3>registration-confirmation-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L232">view source</a></div></div><div class="public anchor" id="var-report-errors"><h3>report-errors</h3><div class="usage"><code>(report-errors db token reason should-be-confirmed?)</code><code>(report-errors db id code reason should-be-confirmed?)</code><code>(report-errors db id token code reason should-be-confirmed?)</code></div><div class="doc"><div class="markdown"><p>Returns a set of keywords indicating confirmation errors detected when querying the confirmations table. When <code>token</code> is given then it will be used to match the correct data row. When <code>id</code> and <code>code</code> are given then they will be used to match the correct data row. When the <code>id</code> is given but the <code>code</code> is <code>nil</code> then the matching will be performed on <code>id</code> and <code>reason</code> (to match on <code>id</code> only and not <code>reason</code>, explicitly set code to <code>false</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L479">view source</a></div></div><div class="public anchor" id="var-report-errors-code-query"><h3>report-errors-code-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L463">view source</a></div></div><div class="public anchor" id="var-report-errors-id-query"><h3>report-errors-id-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L462">view source</a></div></div><div class="public anchor" id="var-report-errors-simple-id-query"><h3>report-errors-simple-id-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L461">view source</a></div></div><div class="public anchor" id="var-report-errors-token-query"><h3>report-errors-token-query</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L464">view source</a></div></div><div class="public anchor" id="var-retry-email"><h3>retry-email</h3><div class="usage"><code>(retry-email udata)</code><code>(retry-email db id)</code><code>(retry-email db id reason)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L655">view source</a></div></div><div class="public anchor" id="var-retry-phone"><h3>retry-phone</h3><div class="usage"><code>(retry-phone udata)</code><code>(retry-phone db id)</code><code>(retry-phone db id reason)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L660">view source</a></div></div><div class="public anchor" id="var-specific-id"><h3>specific-id</h3><div class="usage"><code>(specific-id errs id src-id email-id phone-id)</code><code>(specific-id errs src-id dst-id)</code></div><div class="doc"><div class="markdown"><p>Makes errors more specific by replacing generic bad ID error (as a keyword) with a bad e-mail or phone error.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L506">view source</a></div></div><div class="public anchor" id="var-status"><h3>status</h3><div class="usage"><code>(status db id qtoken)</code><code>(status db id qtoken reason)</code></div><div class="doc"><div class="markdown"><p>Returns confirmation status as a map containing the following keys: <code>:id</code>, <code>:id_type</code>, <code>:attempts</code>, <code>:expires</code>, <code>:token</code>, <code>:confirmed?</code> and <code>:qtoken</code>. The arguments should be <code>db</code> (database connection object), <code>id</code> (user’s identity for which the verification is required), <code>qtoken</code> (quick token derived from confirmation token to authorize the operation) and optional <code>reason</code> (confirmation reason). If reason is not given then all user’s confirmation for the given identity will be analyzed and their quick tokens calculated; the first quick token that matches the one passed as an argument will cause the result to be returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L692">view source</a></div></div><div class="public anchor" id="var-update-request-id"><h3>update-request-id</h3><div class="usage"><code>(update-request-id db token request-id)</code><code>(update-request-id db id code request-id)</code><code>(update-request-id db id code token request-id)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L667">view source</a></div></div><div class="public anchor" id="var-verify-bad-code-set"><h3>verify-bad-code-set</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L467">view source</a></div></div><div class="public anchor" id="var-verify-bad-id-set"><h3>verify-bad-id-set</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L466">view source</a></div></div><div class="public anchor" id="var-verify-bad-token-set"><h3>verify-bad-token-set</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/model/confirmation.clj#L468">view source</a></div></div></div></body></html>