
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
cantina-app-ui-users
Advanced tools
Drop-in UI for cantina-app-users
Just include cantina-app-ui-users in your main app file and start using the default UI.
You can optionally extend the UI implementation by adding your own templates to override the above, adding form field partials, and adding hooks to change the default controller behavior
var app = require('cantina').createApp();
app.boot(function (err) {
if (err) throw err;
app.require('cantina-web');
app.require('cantina-app-ui-users');
app.start();
});
module.exports = function (app) {
app.hook('controller:before:render:users/register').add(function (req, res, context, options, next) {
context.formFields || (context.formFields = []);
context.formFields.push({
template: 'partials/users/registerFields'
});
next();
});
app.hook('controller:form:validate:register').add(function (req, res, next) {
if (!res.vars.values.organization) {
res.formError('organization', 'Organization is required.');
}
if (!res.vars.values.title) {
res.formError('title', 'Title is required.');
}
next();
});
};
<div class="form-group {{#if formErrors.organization}} error{{/if}} organization">
<input name="organization" type="text" autocomplete="off" id="organization-register" placeholder="Organization" class="form-control" value="{{values.organization}}">
{{#if formErrors.organization}}<span class="help-block">{{formErrors.organization}}</span>{{/if}}
</div>
<div class="form-group {{#if formErrors.title}} error{{/if}} title">
<input name="title" type="text" autocomplete="off" id="title-register" placeholder="Title" class="form-control" value="{{values.title}}">
{{#if formErrors.title}}<span class="help-block">{{formErrors.title}}</span>{{/if}}
</div>
###Hooks
####controller:before:render:[template](res, res, context, options)
Runs before a template gets rendered. Allows app or plugins to hook in and modify vars or prevent the render.
####controller:form:validate:[endpoint](req, res)
Runs at the time of form validation for each controller. Allows app or plugins to hook in and add own validation to submitted form.
###Endpoints
####Login
/login
users/login
####Logout
/logout
####Password Reset Request
/forgot
users/forgot
####Password Reset Form
/forgot/:token
users/forgot-reset
####Register
/register
, /registered
users/register
####Activate
/account-confirm/:token
, /account-confirm/resend
users/account_confirm
####Administrate Users
/admin/users
users/administrate_users
, users/partials/user
###Partials
users/partials/extraFields
Applies an additional partial to each of the above forms, allowing the app or
plugin to extend forms. Just include an array of template paths on
res.formFields
and they will be appended to the default forms.
Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Santa Cruz, CA and Washington, D.C.
FAQs
Drop-in UI for cantina-app-users
The npm package cantina-app-ui-users receives a total of 2 weekly downloads. As such, cantina-app-ui-users popularity was classified as not popular.
We found that cantina-app-ui-users demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.