Giter Site home page Giter Site logo

seccomiro / adonis-auth-scaffold Goto Github PK

View Code? Open in Web Editor NEW

This project forked from creatrixity/adonis-auth-scaffold

0.0 1.0 0.0 103 KB

Painless authentication scaffolding for your Adonis.js app available to you in one sexy command.

License: GNU General Public License v3.0

JavaScript 79.34% HTML 11.64% CSS 9.03%

adonis-auth-scaffold's Introduction

Adonis Auth Scaffold Logo

Adonis Auth Scaffold.

Adonis auth scaffold offers you painless authentication built on top Persona.js available within seconds.

Spend those minutes you'd use in setting up authentication doing awesome stuff within your app.

Index

Introduction

Directory Structure

app
└── Controllers
    └── HTTP
        ├── AuthController.js
        ├── ApiAuthController.js
config
    ├── adonis-auth-scaffold.js
public
    └── auth
        ├── auth-styles.css
resources
    └── views
        └── auth
            └── emails
                ├── password.edge
                ├── welcome-mail.edge
            └── partials
                ├── password-change-form.edge
                ├── password-reset-request-form.edge
            └── layouts
                ├── auth.edge
            ├── dashboard.edge
            ├── login.edge
            ├── password-reset.edge
            ├── register.edge
start
    ├── authEvents.js
    ├── authRoutes.js
    ├── apiAuthRoutes.js

About Adonis Auth Scaffold.

Adonis Auth Scaffold is a CLI utility that gives you a functional authentication system in Adonis.js within seconds.

Getting Started

Installation

Install adonis-auth-scaffold by running the below command.

NPM

npm install adonis-auth-scaffold --save-dev
npm install @adonisjs/mail @adonisjs/persona @adonisjs/validator

Yarn

yarn add adonis-auth-scaffold --save-dev
yarn add @adonisjs/mail @adonisjs/persona @adonisjs/validator

Register providers.

The adonis-auth-scaffold provider must be registered as an aceProvider. We are running CLI commands after all!

const aceProviders = [
  'adonis-auth-scaffold/providers/AdonisAuthScaffoldProvider'
];

Also add providers for the newly installed dependencies.

const providers = [
  "@adonisjs/validator/providers/ValidatorProvider",
  "@adonisjs/mail/providers/MailProvider",
  "@adonisjs/persona/providers/PersonaProvider"
]

Register Middleware

Register the below middleware in start/kernel.js

const globalMiddleware = [
  "App/Middleware/ViewHelper"
]

Generating auth scaffold.

Auth Scaffold Gif

Please run the below command to scaffold authentication.

adonis make:auth

A prompt to choose between generating code for a RESTful Api or a HTTP client allows you customize the generated files for your specific use case. Alternative versions of this command involves passing either the --api-only or --http-only flags.

To generate auth files for a REST Api, you may run:

adonis make:auth --api-only

Events

Please add the following line at the beginning of start/events.js.

require('./authEvents');

Migrations

Run the following command to run startup migrations. Please remember to add the status column to your User migration.

adonis migration:run

Contributing

Contributions are welcome! Check out the issues or the PRs, and make your own if you want something that you don't see there.

License

GPLv3.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.