seanbradley / flask-simple-registration Goto Github PK
View Code? Open in Web Editor NEWThis project forked from marchon/flask-simple-registration
Basic simple registration package for Flask.
License: MIT License
This project forked from marchon/flask-simple-registration
Basic simple registration package for Flask.
License: MIT License
Flask-Simple-Registration ========================= This Flask extension provides a somewhat opinionated method of doing the very basic components needed for user registration and login/logout. It allows for lots of flexibility and should be what you need to get a basic system up and running. It assumes that you're using Flask-WTF and Flask-SQLAlchemy. You can customize the forms and your user model to be whatever you'd like. This essentially provides the boilerplate code. Unfortunately, you still have to write some yourself. This registration also doesn't do things like email validation before a user is active - it's designed for simple use cases. Setup ===== First off, you're going to need to create some forms and models for your application. They should inheret from from flaskext import simpleregistration # set up your app, etc. Then... simplereg = simpleregistration.SimpleRegistration( app=app, user_model=MyUserModel, login_url="/login", login_form=MyLoginForm, login_redirect="dashboard", logout_url="/logout", logout_redirect="index", signup_url="/signup", signup_form=MySignupForm, signup_redirect="welcome" ) And you're good to go, assuming that your forms and models have the required methods. For the _url methods, simpleregistration routes that for you. For the _redirect urls, simpleregistration will do the url_for routing for you. Forms and Models ================ Your login form should at some point during the validation process set the "user" attribute on itself to be an instance of your user. This user object *must* provide a *user_id* property. This will get stored in the session and be used to provide the global user object. The signup form *must* provide a *save* method. This saves the user based on the form's data and returns an instance of the user, which is then used to log the user in immediately. Login Required ============== There's a decorator to provide login-required functionality. @flaskext.login_required will redirect the user to a login form with a "next" GET arg. Once the user logs in, they will be redirected back to the page they were on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.