ok what i mean is I have an already working authentication system so I do not want to use okta. how do i use my own developed authentication system i built with flask or php. how do i make this happen. below is my view for sign up and log in in flask how do i use this with your source because i do not want okta for authenticaton.
-- coding: utf-8 --
from flask import redirect, render_template, request, url_for, flash, Blueprint
from flask_login import login_required, login_user, logout_user, current_user
from app.auth.forms import LoginForm, RegistrationForm
from datetime import date, datetime
from app.models import db, Users, Upload
app/auth/views.py
auth_blueprint = Blueprint('auth', name)
@auth_blueprint.route('/')
def index():
return '
This is AUTH main Route
'
@auth_blueprint.route('/register', methods=['GET', 'POST'])
def register():
"""
Handle requests to the /register route
Add an user to the database through the registration form
"""
form = RegistrationForm()
if form.validate_on_submit():
user = Users(email=form.email.data,
username=form.username.data,
first_name=form.first_name.data,
last_name=form.last_name.data,
password=form.password.data)
# add user to the database
db.session.add(user)
db.session.commit()
flash('You have successfully registered! You may now login.')
# redirect to the login page
return redirect(url_for('auth.login'))
# load registration template
return render_template('auth/register.html', form=form, title='Register')
@auth_blueprint.route('/login', methods=['GET', 'POST'])
def login():
"""
Handle requests to the /login route
Log an User in through the login form
"""
form = LoginForm()
if form.validate_on_submit():
# check whether User exists in the database and whether
# the password entered matches the password in the database
user = Users.query.filter_by(email=form.email.data).first()
if Users is not None and user.verify_password(
form.password.data):
# log User in
login_user(user)
# redirect to the dashboard page after login
return redirect(url_for('dashboard.index'))
# when login details are incorrect
else:
flash('Invalid email or password.')
# load login template
return render_template('auth/login.html', form=form, title='Login')
@auth_blueprint.route('/logout')
@login_required
def logout():
"""
Handle requests to the /logout route
Log an employee out through the logout link
"""
logout_user()
flash('You have successfully been logged out.')
# redirect to the login page
return redirect(url_for('auth.login'))