buzzingpixel/corbomite-user

3.1.0 2019-04-22 18:28 UTC

This package is auto-updated.

Last update: 2024-04-23 06:18:42 UTC


README

Part of BuzzingPixel's Corbomite project.

This project provides user management for corbomite projects.

Usage

When you require this into a Corbomite project, the CLI commands, schedule config, and dependency injection config will automatically be set up.

Installation

Corbomite User needs to add a few database tables in order to function. In order to do this, it needs to create some migrations which then need to be run. Run the create-migrations command, which will place migration files in your Corobomite project.

php app user/create-migrations

After running that command, you'll need to run the migrations:

php app migrate/up

Creating a user from the CLI

A CLI action is provided so you can add a user from the CLI.

php app user/create

The API

Most things you'll need to do are available through the API:

$userApi = Di::get(\corbomite\user\UserApi::class);

Schedule

Make sure you're running the schedule command every minute on a cron job. Corbomite User has two commands that it schedules that need to run in order for everything to work right.

Http Actions

Log In Action

The Login Action is provided to make it easy for you to provide a login form. Here's an example:

{% if dataStore().storeItem('LogInAction.hasError') %}
    <div class="ErrorBanner">
        There was an error logging you in!
    </div>
{% endif %}
<form method="post" accept-charset="UTF-8">
    {{ getCsrfInput() }}
    <input type="hidden" name="action" value="logIn">
    <input type="email" name="email">
    <input type="password" name="password">
    <input type="submit">
</form>
{% if flashDataApi().getFlashData().getStoreItem('LogInAction').dataItem('success') ?? false %}
    Logged in successfully!
{% endif %}

License

Copyright 2019 BuzzingPixel, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.