Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
d2f0c56
added auth dir in AuthCommand to move controllers to controllers/auth/
gdhameeja Aug 15, 2019
63250a7
added Python 3.8 and removed 3.4 from circle build
josephmancuso Aug 17, 2019
b6491ec
fixed 3.8 image
josephmancuso Aug 17, 2019
d5e0a6b
added crednetials for 38
josephmancuso Aug 17, 2019
de77c6b
fixed indent
josephmancuso Aug 17, 2019
0bd4836
changed python image
josephmancuso Aug 17, 2019
20c8762
fixed python tag
josephmancuso Aug 17, 2019
b1f9ebe
changed to circle image
josephmancuso Aug 17, 2019
68a13ea
fixed keyword issue for Python 3.8
josephmancuso Aug 17, 2019
cd72ad2
removed custom test message
josephmancuso Aug 17, 2019
fc32c91
Merge pull request #876 from MasoniteFramework/feature/874
josephmancuso Aug 17, 2019
b67d86c
specified path in routers for controllers as auth.*
gdhameeja Aug 29, 2019
aacc3cf
removed storage module from container
josephmancuso Aug 31, 2019
95ceca3
removed cache config
josephmancuso Aug 31, 2019
8c05d5a
removed storage config from being imported
josephmancuso Aug 31, 2019
0bfe591
removed application config from container
josephmancuso Aug 31, 2019
aa9dcba
removed providers config
josephmancuso Aug 31, 2019
31216a4
removed providers config
josephmancuso Aug 31, 2019
068e85e
linted
josephmancuso Aug 31, 2019
667bf53
Merge branch 'master' into fix-777
gdhameeja Sep 2, 2019
375d645
added a responsable class and mail is responsable
josephmancuso Sep 8, 2019
54abac3
config circleci config
josephmancuso Sep 8, 2019
9cd1ed7
config
josephmancuso Sep 8, 2019
c11bc38
fixed install
josephmancuso Sep 8, 2019
ea41cdf
Merge pull request #875 from gdhameeja/fix-777
josephmancuso Sep 14, 2019
31548e1
Merge branch 'develop' into feature/891
josephmancuso Sep 14, 2019
85a26c7
Merge pull request #892 from MasoniteFramework/feature/891
josephmancuso Sep 14, 2019
b680581
Merge branch 'develop' into refactor-2.3
josephmancuso Oct 20, 2019
9ad0111
Merge pull request #889 from MasoniteFramework/refactor-2.3
josephmancuso Oct 20, 2019
10efd7a
refactored for tests
josephmancuso Oct 21, 2019
26690ff
more refactoring
josephmancuso Oct 21, 2019
7a01afb
refactored drivers
josephmancuso Oct 21, 2019
f3609bc
refactored
josephmancuso Oct 21, 2019
db30083
finished src refactor
josephmancuso Oct 21, 2019
2d006d8
fixed version
josephmancuso Oct 21, 2019
4a9ef4e
Merge pull request #927 from MasoniteFramework/feature/src
josephmancuso Oct 21, 2019
1490c4e
meged 2.2 into develop
josephmancuso Oct 27, 2019
b6e9083
fixed tests between 2.2 and 2.3
josephmancuso Oct 27, 2019
bfbeb32
fixed duplicate error for circleci
josephmancuso Oct 27, 2019
a967cd6
removed duplicate key in build steps
josephmancuso Oct 27, 2019
abee88b
removed unused imports
josephmancuso Oct 27, 2019
9555e69
cleaned up deepsource issues
josephmancuso Oct 27, 2019
52c774f
convert to string before bytes
josephmancuso Oct 27, 2019
b3d1359
bumped to 2.3 version
josephmancuso Oct 27, 2019
08155a4
added str to byets
josephmancuso Oct 27, 2019
7f41d87
fixed manifest file
josephmancuso Oct 28, 2019
f28dddb
bumped validation version
josephmancuso Oct 28, 2019
5c88b8c
removed requirements
josephmancuso Oct 28, 2019
47d5ca5
fixed classifier
josephmancuso Oct 28, 2019
dea5fcd
fixed readme issues
josephmancuso Oct 28, 2019
5e499fe
merged 2.2
josephmancuso Oct 29, 2019
4619b2a
modifying tests
josephmancuso Oct 30, 2019
d8ad94c
merged
josephmancuso Oct 30, 2019
b78cdcc
improved authentication system with guards
josephmancuso Oct 30, 2019
cc28fad
guards must be registered
josephmancuso Oct 30, 2019
de2e46d
fixed guards
josephmancuso Oct 31, 2019
35d4224
added authentication provider
josephmancuso Oct 31, 2019
ac747a1
added guard middleware
josephmancuso Oct 31, 2019
ac70f3d
merged 2.2 into develop
josephmancuso Oct 31, 2019
b0f30eb
Merge branch 'develop' into feature/931
josephmancuso Oct 31, 2019
553d15d
fixed guard test
josephmancuso Oct 31, 2019
0983c7e
removed references to testsuite class
josephmancuso Oct 31, 2019
0632a45
fixed circleci orb
josephmancuso Nov 2, 2019
6865b7c
added base authentication guard
josephmancuso Nov 2, 2019
8582535
added comments
josephmancuso Nov 2, 2019
cfe4749
fixed response exception block
josephmancuso Nov 2, 2019
db79421
linted
josephmancuso Nov 2, 2019
e24a218
Merge pull request #932 from MasoniteFramework/feature/931
josephmancuso Nov 2, 2019
11392ac
Merge branch 'develop' into feature/933
josephmancuso Nov 2, 2019
a7a8665
fixed middleware test
josephmancuso Nov 2, 2019
5efafb4
fixed conflicts
josephmancuso Nov 2, 2019
fab6a0f
fixed unused imports
josephmancuso Nov 2, 2019
a91ebd9
linted
josephmancuso Nov 2, 2019
1e5c551
Merge pull request #934 from MasoniteFramework/feature/933
josephmancuso Nov 2, 2019
44ad8fc
linted
josephmancuso Nov 2, 2019
ec1bf8e
fixed skipcq rules
josephmancuso Nov 2, 2019
5561d1f
linted
josephmancuso Nov 2, 2019
b352c4d
Adding an server that support Option preflight request.
Marlysson Jan 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
version: 2.1

commands:
install:
steps:
- run: pip install . --user
- run: pip install -r requirements.txt --user

jobs:
build:
docker:
- image: circleci/python:3.6 # primary container for the build job
steps:
- checkout
- run: make
- install
- run: make test
lint:
docker:
- image: circleci/python:3.6 # primary container for the build job
steps:
- checkout
- run: make
- install
- run: make lint
python34:
docker:
- image: circleci/python:3.4
steps:
- checkout
- run: make
- run: make test
python35:
docker:
- image: circleci/python:3.5
- image: circleci/python:3.7
steps:
- checkout
- run: make
- install
- run: make test
python37:
docker:
- image: circleci/python:3.7
- image: circleci/python:3.8.0b2-buster
auth:
username: jmancuso9 # can specify string literal values
password: $DOCKERHUB_PASSWORD
steps:
- checkout
- run: make
- install
- run: make test
python38:
docker:
Expand All @@ -47,31 +50,28 @@ jobs:
- image: circleci/python:3.6
steps:
- checkout
- install
- run: pip install -r requirements.txt --user
- run: make coverage
- run: make deepsource

orbs:
masonite: masonite/trigger@dev:latest
masonite: masonite/trigger@1.0.0

workflows:
version: 2
build_and_test:
jobs:
- build:
- build: # Python 3.6
filters: # required since `deploy` has tag filters AND requires `build`
tags:
only: /^.*/
- lint:
- lint: # Python 3.6
requires:
- build
filters: # required since `deploy` has tag filters AND requires `build`
tags:
only: /^.*/
- python34:
filters: # required since `deploy` has tag filters AND requires `build`
tags:
only: /^.*/
- python35:
filters: # required since `deploy` has tag filters AND requires `build`
tags:
Expand Down
4 changes: 2 additions & 2 deletions .deepsource.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version = 1

test_patterns = [
'tests/**/*.py',
'masonite/testing/*.py',
'masonite/testsuite/*.py',
'src/masonite/testing/*.py',
'src/masonite/testsuite/*.py',
'testpackage/*.py'
]

Expand Down
14 changes: 7 additions & 7 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include masonite/snippets/exceptions/css/*
include masonite/snippets/exceptions/*
include masonite/snippets/*
include masonite/snippets/migrations/*
include masonite/snippets/scaffold/*
include masonite/snippets/auth/controllers/*
include masonite/snippets/auth/templates/auth/*
include src/masonite/snippets/exceptions/css/*
include src/masonite/snippets/exceptions/*
include src/masonite/snippets/*
include src/masonite/snippets/migrations/*
include src/masonite/snippets/scaffold/*
include src/masonite/snippets/auth/controllers/*
include src/masonite/snippets/auth/templates/auth/*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ ci:
make test
make lint
lint:
python -m flake8 masonite/ --ignore=E501,F401,E128,E402,E731,F821,E712,W503
python -m flake8 src/masonite/ --ignore=E501,F401,E128,E402,E731,F821,E712,W503
deepsource:
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
coverage:
python -m pytest --cov-report term --cov-report xml --cov=masonite tests/
python -m pytest --cov-report term --cov-report xml --cov=src/masonite tests/
python -m coveralls
publish:
pip install 'twine>=1.5.0'
Expand Down
70 changes: 70 additions & 0 deletions app/http/controllers/ConfirmController.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""The ConfirmController Module."""
import datetime

from src.masonite.auth import Auth, MustVerifyEmail
from src.masonite.auth.Sign import Sign
from src.masonite.managers import MailManager
from src.masonite.request import Request
from src.masonite.view import View
from src.masonite.helpers import config


class ConfirmController:
"""The ConfirmController class."""

def __init__(self):
"""The ConfirmController Constructor."""
pass

def verify_show(self, view: View, auth: Auth):
"""Show the Verify Email page for unverified users.

Arguments:
request {masonite.request.request} -- The Masonite request class.
request {masonite.view.view} -- The Masonite view class.
request {masonite.auth.auth} -- The Masonite Auth class.

Returns:
[type] -- [description]
"""
return view.render('auth/verify', {'app': config('application'), 'Auth': auth})

def confirm_email(self, request: Request, view: View, auth: Auth):
"""Confirm User email and show the correct response.

Arguments:
request {masonite.request.request} -- The Masonite request class.
request {masonite.view.view} -- The Masonite view class.
request {masonite.auth.auth} -- The Masonite Auth class.

Returns:
[type] -- [description]
"""
sign = Sign()
token = sign.unsign(request.param('id'))

if token is not None:
tokenParts = token.split("::")
if len(tokenParts) > 1:
user = auth.auth_model.find(tokenParts[0])

if user.verified_at is None:
timestamp = datetime.datetime.fromtimestamp(float(tokenParts[1]))
now = datetime.datetime.now()
timestamp_plus_10 = timestamp + datetime.timedelta(minutes=10)

if now < timestamp_plus_10:
user.verified_at = datetime.datetime.now()
user.save()

return view.render('auth/confirm', {'app': config('application'), 'Auth': auth})

return view.render('auth/error', {'app': config('application'), 'Auth': auth})

def send_verify_email(self, manager: MailManager, request: Request):
user = request.user()

if isinstance(user, MustVerifyEmail):
user.verify_email(manager, request)

return request.redirect('/home')
4 changes: 2 additions & 2 deletions app/http/controllers/ControllerTest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from masonite.request import Request
from masonite.view import View
from src.masonite.request import Request
from src.masonite.view import View


class ControllerTest:
Expand Down
11 changes: 7 additions & 4 deletions app/http/controllers/TestController.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from app.jobs.TestJob import TestJob
from masonite import Queue
from masonite.request import Request
from masonite.view import View
from src.masonite import Queue, Mail
from src.masonite.request import Request
from src.masonite.view import View

class TestController:

Expand Down Expand Up @@ -29,7 +29,7 @@ def change_404(self, request: Request):
def testing(self):
return 'test'

def json_response(self, request: Request):
def json_response(self):
return {'id': 2}

def post_test(self):
Expand All @@ -53,3 +53,6 @@ def queue(self, queue: Queue):
# queue.driver('amqp').push(self.bad)
queue.driver('amqp').push(TestJob, channel='default')
return 'queued'

def mail(self, mail: Mail):
return mail.to('idmann509@gmail.com').template('test', {'test': 'mail'})
4 changes: 2 additions & 2 deletions app/http/controllers/UnitTestController.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""A UnitTestController Module."""

from masonite.request import Request
from masonite.controllers import Controller
from src.masonite.request import Request
from src.masonite.controllers import Controller


class UnitTestController(Controller):
Expand Down
7 changes: 3 additions & 4 deletions app/http/controllers/WelcomeController.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Welcome The User To Masonite."""

from masonite.view import View
from masonite.request import Request
from masonite.controllers import Controller
from src.masonite.view import View
from src.masonite.controllers import Controller


class WelcomeController(Controller):
"""Controller For Welcoming The User."""

def show(self, view: View, request: Request):
def show(self, view: View):
"""Show the welcome page.

Arguments:
Expand Down
4 changes: 2 additions & 2 deletions app/http/middleware/AddAttributeMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Add Attribute Middleware."""

from masonite.request import Request
from src.masonite.request import Request


class AddAttributeMiddleware:
"""Middleware class which loads the current user into the request."""

def __init__(self, request: Request):
"""Inject Any Dependencies From The Service Container."""
self.request = Request
self.request = request

def before(self):
"""Run This Middleware Before The Route Executes."""
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/AuthenticationMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Authentication Middleware."""

from masonite.request import Request
from src.masonite.request import Request


class AuthenticationMiddleware:
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/CsrfMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""CSRF Middleware."""

from masonite.middleware import CsrfMiddleware as Middleware
from src.masonite.middleware import CsrfMiddleware as Middleware


class CsrfMiddleware(Middleware):
Expand Down
4 changes: 2 additions & 2 deletions app/http/middleware/LoadUserMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Load User Middleware."""

from masonite.auth import Auth
from masonite.request import Request
from src.masonite.auth import Auth
from src.masonite.request import Request


class LoadUserMiddleware:
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/MiddlewareTest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Middleware Test."""

from masonite.request import Request
from src.masonite.request import Request


class MiddlewareTest:
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/TestHttpMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from masonite.request import Request
from src.masonite.request import Request


class TestHttpMiddleware:
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/TestMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from masonite.request import Request
from src.masonite.request import Request


class TestMiddleware:
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/VerifyEmailMiddleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Verify Email Middleware."""

from masonite.request import Request
from src.masonite.request import Request


class VerifyEmailMiddleware:
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/TestJob.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" A TestJob Queue Job """

from masonite.queues import Queueable
from src.masonite.queues import Queueable


class TestJob(Queueable):
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/start.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Start of Application. This function is the gunicorn server."""

from masonite.environment import LoadEnvironment
from src.masonite.environment import LoadEnvironment

"""Load Environment Variables
Take environment variables from the .env file and load them in.
Expand Down
9 changes: 7 additions & 2 deletions config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os

from masonite import env
from src.masonite import env

"""Application Name
This value is the name of your application. This value is used when the
Expand Down Expand Up @@ -57,4 +57,9 @@
'app',
]

FALSY = False
FALSY = False

TEMPLATES={
'statuscode': '/src/masonite/snippets/statuscode',
'exceptions': '/src/masonite/snippets/exception'
}
Loading