Git Product home page Git Product logo

ks_auth's Introduction

ks_auth

Setup

  • Install postgres
  • Set connection string, project name & auth table in ./constants/keystone.constants.js
  • Run migrations
  • Start yarn dev

Demo

To run demo for auth flow execute this script:

CREATE SEQUENCE users_id_seq START 101;
CREATE TYPE public.enum_users_role AS ENUM ('trainee', 'trainer', 'admin');
CREATE TABLE public.users(
    id integer NOT NULL DEFAULT nextval('users_id_seq'),
    email character varying(255) COLLATE pg_catalog."default",
    "passwordHash" character varying(255) COLLATE pg_catalog."default",
    "createdAt" timestamp with time zone NOT NULL,
    "updatedAt" timestamp with time zone NOT NULL,
    role enum_users_role NOT NULL,
    "isEmailConfirmed" boolean NOT NULL DEFAULT false,
    CONSTRAINT users_pkey PRIMARY KEY (id),
    CONSTRAINT users_email_key UNIQUE (email)
)

After, insert user with admin creds.

Example:
INSERT INTO users (email, "passwordHash", "createdAt", "updatedAt", role)
VALUES ('[email protected]', '{hashed password}', '1970-01-01 00:00:00+00', '1970-01-01 00:00:00+00', 'admin');

After, you can login to admin UI with this creds, and create/update/delete users.

Custom fields

Why?

Field's like createdAt & updatedAt created as fields with hooks to update the date after some changes have been added. These fields are hidden to the user, and cannot be edited by user. After all, by default DateTime & DateTimeUtc include additional fields such as {date}_utc, {date}_offset. We already have DB schemas, and these fields are not in these schemas.

Where?

  1. createdAt - ./custom-fields/createdAt.field.js
  2. updatedAt - ./custom-fields/updatedAt.field.js

ks_auth's People

Contributors

ashevchenko0309 avatar

Watchers

Alexander Shcherbakov avatar  avatar

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.