GithubHelp home page GithubHelp logo

isabella232 / osis-registration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uclouvain/osis-registration

0.0 0.0 0.0 1.68 MB

OSIS Registration is a django application to handle external account management

License: GNU Affero General Public License v3.0

Python 72.48% Shell 0.26% CSS 8.34% HTML 18.92%

osis-registration's Introduction

osis-registration

OSIS Registration is a django application to handle external account management. It provides a publish-subscribe mecanism to enable applications (subscribers) to request user account creation. OSIS Registration enable subscribers to poll an API endpoint in order for them to catch up on the last requested results.

Getting started

Clone the repository

git clone [email protected]:uclouvain/osis-registration.git

Create the database (assuming you already have postgresql installed)

createdb osis_registration_local
createuser osis -P //provide password of your choice
psql -d osis_registration_local
  =# grant connect on database osis_registration_local to osis;
  =# revoke connect on database osis_registration_local from public;
  =# alter user osis createdb;
  =# \q

Enter the repository

cd osis-registration

Make sure you have some python tools needed for creating your virtual environment

sudo apt-get install build-essential python3-venv libjpeg-dev libpng-dev gettext

Create and activate venv

python3 -m venv venv
source venv/bin/activate

Install required dependencies

pip install -r requirements.txt

Create a .env file based on .env.example:

cp .env.example .env

Create the data structre in db:

python3 manage.py migrate

Create the superuser (will later be used to access /admin page):

python3 manage.py createsuperuser

Compile translation files

python3 manage.py compilemessages

Run the server

python3 manage.py runserver

To enable 'audio captcha', please refer to the 'Espeak and Sox' section below.

That's all folks !

API

OSIS Registration provides subscribers with a RESTful API enabling apps to request user account creation and poll the requests results. The subscribers are registered as Django users and are identified by a token.

An authorization header with the registered app token must be provided with the request.

Authorization header

{"Authorization": "Token cf4e903f8cc6cb81ae753d137bfa77cdfe1b8b37"}

Endpoints

Create

POST /create_account/

Create new user account creation request

Body parameter

{
  "uuid": "abcd-efgh-ijkl-mnop-1234-5678",
  "person_uuid": "abcd-efgh-ijkl-mnop-1234-5678",
  "first_name": "John",
  "last_name": "Doe",
  "birth_date": "1989-01-01",
  "email": "[email protected]"
}

Poll

GET /poll/

List last updated request results for a given subscriber

Example response 200

{
  "uuid": "abcd-efgh-ijkl-mnop-1234-5678",
  "person_uuid": "abcd-efgh-ijkl-mnop-1234-5678",
  "email": "[email protected]",
  "request_type": "CREATION",
  "status": "SUCCESS",
  "app": "internship",
  "updated_at": "2021-08-31T09:51:14.622461"
}

Acknowledge

PUT /acknowledge/

Update subscriber's last poll request to acknowledge poll has been sucessfully retrieved

Body parameter

{
  "last_poll_requested": "2021-08-31T09:51:14.622461"
}

Espeak and Sox

For the sake of accessibility, an audio captcha file is read by synthetic voice.

Espeak

In order to generate this file, espeak has to be installed with english and french voices through the following commands:

apt-get install espeak

Once installed, english is available as a default voice, french should be too. You can verify this with:

espeak --voices=fr

The output should include this line:

 5  fr-fr          M  french               fr            (fr 5)

If it is the case, then you are good to go. Otherwise, you will need to install voices. http://espeak.sourceforge.net/languages.html

Sox

Sox adds some noise to the generated audio to complexify the process of computerized captcha solving. You may install Sox with the following command:

apt-get install sox

osis-registration's People

Contributors

mathieuzen avatar albrugnetti avatar benjneb 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.