LDAP auth seems to work too.

Users completely refactored to ReactJS and Knex
Initial draft of call context passing (for the time being only in users:remove
This commit is contained in:
Tomas Bures 2017-07-08 20:32:04 +02:00
parent 9758b4b104
commit be7da791db
11 changed files with 24 additions and 816 deletions

View file

@ -1,219 +0,0 @@
<ol class="breadcrumb">
<li><a href="/">{{#translate}}Home{{/translate}}</a></li>
<li class="active">{{#translate}}API{{/translate}}</li>
</ol>
<h2>{{#translate}}API{{/translate}}</h2>
<hr>
<div class="panel panel-default">
<div class="panel-body">
<div class="pull-right">
<form class="form-horizontal confirm-submit" {{#if accessToken}} data-confirm-message="{{#translate}}Are you sure? Resetting would invalidate the currently existing token.{{/translate}}" {{else}} data-confirm-message="{{#translate}}Are you sure?{{/translate}}" {{/if}} method="post" action="/users/api/reset-token">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<button type="submit" class="btn btn-info"><span class="glyphicon glyphicon-retweet" aria-hidden="true"></span>
{{#if accessToken}}
{{#translate}}Reset Access Token{{/translate}}
{{else}}
{{#translate}}Generate Access Token{{/translate}}
{{/if}}
</button>
</form>
</div>
{{#if accessToken}}
{{#translate}}Personal access token:{{/translate}} <code>{{accessToken}}</code>
{{else}}
{{#translate}}Access token not yet generated{{/translate}}
{{/if}}
</div>
</div>
<div class="well">
<h3>{{#translate}}Notes about the API{{/translate}}</h3>
<ul>
<li>
{{#translate}}API response is a JSON structure with <code>error</code> and <code>data</code> properties. If the response <code>error</code> has a value set then the request failed.{{/translate}}
</li>
<li>
{{#translate}}You need to define proper <code>Content-Type</code> when making a request. You can either use <code>application/x-www-form-urlencoded</code> for normal form data or <code>application/json</code> for a JSON payload. Using <code>multipart/form-data</code> is not supported.{{/translate}}
</li>
</ul>
</div>
<h3>POST /api/subscribe/:listId {{#translate}}Add subscription{{/translate}}</h3>
<p>
{{#translate}}This API call either inserts a new subscription or updates existing. Fields not included are left as is, so if you update only LAST_NAME value, then FIRST_NAME is kept untouched for an existing subscription.{{/translate}}
</p>
<p>
<strong>GET</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>access_token</strong> {{#translate}}your personal access token{{/translate}}
</ul>
<p>
<strong>POST</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>EMAIL</strong> {{#translate}}subscriber's email address{{/translate}} (<em>{{#translate}}required{{/translate}}</em>)</li>
<li><strong>FIRST_NAME</strong> {{#translate}}subscriber's first name{{/translate}}</li>
<li><strong>LAST_NAME</strong> {{#translate}}subscriber's last name{{/translate}}</li>
<li><strong>TIMEZONE</strong> {{#translate}}subscriber's timezone (eg. "Europe/Tallinn", "PST" or "UTC"). If not set defaults to "UTC"{{/translate}}</li>
<li><strong>MERGE_TAG_VALUE</strong> {{#translate}}custom field value. Use yes/no for option group values (checkboxes, radios, drop downs){{/translate}}</li>
</ul>
<p>
{{#translate}}Additional POST arguments{{/translate}}:
</p>
<ul>
<li>
<strong>FORCE_SUBSCRIBE</strong> {{#translate}}set to "yes" if you want to make sure the email is marked as subscribed even if it was previously marked as unsubscribed. If the email was already unsubscribed/blocked then subscription status is not changed{{/translate}}
by default.
</li>
<li>
<strong>REQUIRE_CONFIRMATION</strong> {{#translate}}set to "yes" if you want to send confirmation email to the subscriber before actually marking as subscribed{{/translate}}
</li>
</ul>
<p>
<strong>{{#translate}}Example{{/translate}}</strong>
</p>
<pre>curl -XPOST {{serviceUrl}}api/subscribe/B16uVTdW?access_token={{accessToken}} \
--data 'EMAIL=test@example.com&amp;MERGE_CHECKBOX=yes&amp;REQUIRE_CONFIRMATION=yes'</pre>
<h3>POST /api/unsubscribe/:listId {{#translate}}Remove subscription{{/translate}}</h3>
<p>
{{#translate}}This API call marks a subscription as unsubscribed{{/translate}}
</p>
<p>
<strong>GET</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>access_token</strong> {{#translate}}your personal access token{{/translate}}
</ul>
<p>
<strong>POST</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>EMAIL</strong> {{#translate}}subscriber's email address{{/translate}} (<em>{{#translate}}required{{/translate}}</em>)
</ul>
<p>
<strong>{{#translate}}Example{{/translate}}</strong>
</p>
<pre>curl -XPOST {{serviceUrl}}api/unsubscribe/B16uVTdW?access_token={{accessToken}} \
--data 'EMAIL=test@example.com'</pre>
<h3>POST /api/delete/:listId {{#translate}}Delete subscription{{/translate}}</h3>
<p>
{{#translate}}This API call deletes a subscription{{/translate}}
</p>
<p>
<strong>GET</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>access_token</strong> {{#translate}}your personal access token{{/translate}}
</ul>
<p>
<strong>POST</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>EMAIL</strong> {{#translate}}subscriber's email address{{/translate}} (<em>{{#translate}}required{{/translate}}</em>)
</ul>
<p>
<strong>{{#translate}}Example{{/translate}}</strong>
</p>
<pre>curl -XPOST {{serviceUrl}}api/delete/B16uVTdW?access_token={{accessToken}} \
--data 'EMAIL=test@example.com'</pre>
<h3>GET /api/blacklist/get {{#translate}}Get list of blacklisted emails{{/translate}}</h3>
<p>
{{#translate}}This API call get list of blacklisted emails.{{/translate}}
</p>
<p>
<strong>GET</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>access_token</strong> {{#translate}}your personal access token{{/translate}}
<li><strong>start</strong> {{#translate}}Start position{{/translate}} (<em>{{#translate}}optional, default 0{{/translate}}</em>)</li>
<li><strong>limit</strong> {{#translate}}limit emails count in response{{/translate}} (<em>{{#translate}}optional, default 10000{{/translate}}</em>)</li>
<li><strong>search</strong> {{#translate}}filter by part of email{{/translate}} (<em>{{#translate}}optional, default ''{{/translate}}</em>)</li>
</ul>
<p>
<strong>{{#translate}}Example{{/translate}}</strong>
</p>
<pre>curl -XGET '{{serviceUrl}}api/blacklist/get?access_token={{accessToken}}&limit=10&start=10&search=gmail' </pre>
<h3>POST /api/blacklist/add {{#translate}}Add email to blacklist{{/translate}}</h3>
<p>
{{#translate}}This API call either add emails to blacklist{{/translate}}
</p>
<p>
<strong>GET</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>access_token</strong> {{#translate}}your personal access token{{/translate}}
</ul>
<p>
<strong>POST</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>EMAIL</strong> {{#translate}}email address{{/translate}} (<em>{{#translate}}required{{/translate}}</em>)</li>
</ul>
<p>
<strong>{{#translate}}Example{{/translate}}</strong>
</p>
<pre>curl -XPOST '{{serviceUrl}}api/blacklist/add?access_token={{accessToken}}' \
--data 'EMAIL=test@example.com&amp;'</pre>
<h3>POST /api/blacklist/delete {{#translate}}Delete email from blacklist{{/translate}}</h3>
<p>
{{#translate}}This API call either delete emails from blacklist{{/translate}}
</p>
<p>
<strong>GET</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>access_token</strong> {{#translate}}your personal access token{{/translate}}
</ul>
<p>
<strong>POST</strong> {{#translate}}arguments{{/translate}}
</p>
<ul>
<li><strong>EMAIL</strong> {{#translate}}email address{{/translate}} (<em>{{#translate}}required{{/translate}}</em>)</li>
</ul>
<p>
<strong>{{#translate}}Example{{/translate}}</strong>
</p>
<pre>curl -XPOST '{{serviceUrl}}api/blacklist/delete?access_token={{accessToken}}' \
--data 'EMAIL=test@example.com&amp;'</pre>

View file

@ -1,38 +0,0 @@
<ol class="breadcrumb">
<li><a href="/">{{#translate}}Home{{/translate}}</a></li>
<li><a href="/users/login">{{#translate}}Sign in{{/translate}}</a></li>
<li class="active">{{#translate}}Password Reset{{/translate}}</li>
</ol>
<h2>{{#translate}}Reset your password?{{/translate}}</h2>
<hr>
{{#if ldap.enabled}}
<p>
{{#translate}}Accounts are managed through LDAP.{{/translate}}
<br/>
<br/>
<a href="{{ldap.passwordresetlink}}">{{#translate}}Reset Password{{/translate}}</a>
</p>
{{else}}
<p>{{#translate}}Please provide the username or email address that you used when you signed up for your Mailtrain account.{{/translate}}</p>
<p>{{#translate}}We will send you an email that will allow you to reset your password.{{/translate}}</p>
<form class="form-horizontal" role="login" method="post" action="/users/forgot">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<div class="form-group">
<label for="usernameMain" class="col-sm-2 control-label">{{#translate}}Username{{/translate}}</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="username" id="usernameMain" placeholder="{{#translate}}Username or email address{{/translate}}" autofocus required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-xs-4">
<button type="submit" class="btn btn-primary">{{#translate}}Send verification email{{/translate}}</button>
</div>
</div>
</form>
{{/if}}

View file

@ -1,43 +0,0 @@
<ol class="breadcrumb">
<li><a href="/">{{#translate}}Home{{/translate}}</a></li>
<li class="active">{{#translate}}Sign in{{/translate}}</li>
</ol>
<h2>{{#translate}}Sign in{{/translate}}</h2>
<hr>
<form class="form-horizontal" role="login" method="post" action="/users/login">
<input type="hidden" name="next" value="{{next}}" />
<div class="form-group">
<label for="usernameMain" class="col-sm-2 control-label">{{#translate}}Username{{/translate}}</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="username" id="usernameMain" placeholder="{{#translate}}Username{{/translate}}" autofocus required>
</div>
</div>
<div class="form-group">
<label for="passwordMain" class="col-sm-2 control-label">{{#translate}}Password{{/translate}}</label>
<div class="col-xs-4">
<input type="password" class="form-control" name="password" id="passwordMain" placeholder="{{#translate}}Password{{/translate}}" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-xs-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember"> {{#translate}}Remember me{{/translate}}
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-xs-4">
<button type="submit" class="btn btn-primary">{{#translate}}Sign in{{/translate}}</button> {{#translate}}or{{/translate}}
{{#if ldap.enabled}}
<a href="{{ldap.passwordresetlink}}">{{#translate}}Forgot password?{{/translate}}</a>
{{else}}
<a href="/users/forgot">{{#translate}}Forgot password?{{/translate}}</a>
{{/if}}
</div>
</div>
</form>

View file

@ -1,40 +0,0 @@
<ol class="breadcrumb">
<li><a href="/">{{#translate}}Home{{/translate}}</a></li>
<li><a href="/users/login">{{#translate}}Sign in{{/translate}}</a></li>
<li class="active">{{#translate}}Password Reset{{/translate}}</li>
</ol>
<h2>{{#translate}}Choose your new password{{/translate}}</h2>
<hr>
<form class="form-horizontal" method="post" action="/users/reset">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="username" value="{{username}}">
<input type="hidden" name="reset-token" value="{{resetToken}}">
<p>
{{#translate}}Please enter a new password.{{/translate}}
</p>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">{{#translate}}New Password{{/translate}}</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password" id="password" placeholder="{{#translate}}New Password{{/translate}}">
</div>
</div>
<div class="form-group">
<label for="password2" class="col-sm-2 control-label">{{#translate}}Confirm Password{{/translate}}</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password2" id="password2" placeholder="{{#translate}}Confirm New Password{{/translate}}">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">{{#translate}}Reset Password{{/translate}}</button>
</div>
</div>
</form>