Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Login functionality through Flask-Login and Flask-OpenID #13

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

sathyamvellal
Copy link
Member

Hello. This pull request adds features for login through openid. The changes that have been made are detailed in the commit messages.

Three TODO have been added to views.py and marked TODO to indicate places that require changes after some developments in the future.

The functionality was checked with a local sqlite database and google openid and worked as expected.

Do examine the request critically and let me know if any additional changes are to be made.

The following requirements were added to support flask
login with openid
+ Flask Login
+ Flask WTF
+ Flask OpenID
__init__ module:
+ Import LoginManager
+ variable lm now available. Instance of LoginManager
The following methods have been added to the User model
required by the Flask Login Extension
+ is_authenticated
+ is_active
+ is_anonymous
+ get_id
Created a LoginForm class containing a TextField for openid
The following changes were made to support login
+ Added necessary imports
+ Global variable 'g' now accessible
+ Added views '/login', '/logout'
+ methods to support the login process
	(user_loader, before_request)
+ extends "base.html"
+ has a form, 1 field for openid, 1 submit button
The following changes were made to the core module
+ necessary imports
+ oid, an instance of OpenID
The following changes have been made to support the openid
login functionality through flask login
+ necessary imports
+ openid login handler
+ logout handler
+ other necessary methods
	(after_login)
+ CSRF has been enabled
+ BASEDIR (required to create tmp directory for OpenID)
from flask import Flask
from flask.ext.assets import Environment, Bundle
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.openid import OpenID
from settings import BASEDIR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sathyamvellal you should access variables in settings using app.config['BASEDIR'].

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya. I somehow forgot that :-/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants