Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
include README.md
include LICENSE
include alembic.ini
include name.py
include pytest.ini
graft alembic
graft tests
graft freenit/project
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
Freenit is based on

* [FastAPI](https://fastapi.tiangolo.com/)
* [Ormar](https://github.com/collerek/ormar)
* [Oxyde](https://github.com/oxyde/oxyde)
* [Bonsai](https://github.com/noirello/bonsai)
* [Svelte](https://svelte.dev)
92 changes: 0 additions & 92 deletions alembic.ini

This file was deleted.

14 changes: 0 additions & 14 deletions alembic/env.py

This file was deleted.

24 changes: 0 additions & 24 deletions alembic/script.py.mako

This file was deleted.

92 changes: 0 additions & 92 deletions alembic/versions/f2a9191e9157_initial.py

This file was deleted.

7 changes: 2 additions & 5 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export OFFLINE=${OFFLINE:="no"}

setup() {
cd ${PROJECT_ROOT}
run_migrations="${2:-yes}"
if [ "${SYSPKG}" != "YES" ]; then
if [ ! -d ${HOME}/.virtualenvs/${VIRTUALENV} ]; then
python${PY_VERSION} -m venv "${HOME}/.virtualenvs/${VIRTUALENV}"
Expand All @@ -27,11 +28,7 @@ setup() {
fi
fi

if [ "${DB_TYPE}" = "sql" ]; then
if [ ! -e "alembic/versions" ]; then
mkdir alembic/versions
alembic revision --autogenerate -m initial
fi
if [ "${DB_TYPE}" = "sql" -a "${run_migrations}" != "no" ]; then
python migrate.py
fi
}
7 changes: 1 addition & 6 deletions bin/devel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ export OFFLINE=${OFFLINE:="no"}
setup

export FREENIT_ENV="dev"

if [ ! -e "alembic/versions" ]; then
mkdir -p alembic/versions
alembic revision --autogenerate -m initial
fi
alembic upgrade head
python migrate.py

echo "Backend"
echo "==============="
Expand Down
26 changes: 4 additions & 22 deletions bin/freenit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,6 @@ EOF
- onelove-roles.freebsd-common
- onelove-roles.freebsd_freenit
EOF

cat >alembic/env.py<<EOF
import os
import sys

import ${NAME}.app
from ${NAME}.config import getConfig
from alembic import context
from freenit.migration import run_migrations_offline, run_migrations_online


sys.path.append(os.getcwd())
config = getConfig()


if context.is_offline_mode():
run_migrations_offline(config)
else:
run_migrations_online(config)
EOF

cat >.gitignore<<EOF
.coverage
.pytest_cache
Expand All @@ -132,7 +111,6 @@ ansible/site.yml
!ansible/roles/.keep
!ansible/roles/devel

alembic/versions/*
build
cbsd.conf
coverage.xml
Expand All @@ -148,6 +126,10 @@ dist/
*.sqlite
EOF

if [ "${DB_TYPE:=sql}" = "sql" ] && command -v oxyde >/dev/null 2>&1; then
FREENIT_ENV=dev oxyde makemigrations --name initial
fi

echo "Success!"
cd ..
}
Expand Down
2 changes: 1 addition & 1 deletion bin/security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export FREENIT_ENV="test"
. ${BIN_DIR}/common.sh


setup no
setup no no
bandit `find freenit -type f -name '*.py' | grep -v 'freenit/cli\.py'`
2 changes: 1 addition & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export FREENIT_ENV="test"
. ${BIN_DIR}/common.sh


setup
setup yes no
pytest -v --ignore=freenit/project/
10 changes: 7 additions & 3 deletions freenit/api/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ async def logout(response: Response):


async def register_sql(credentials: LoginInput) -> User:
import ormar.exceptions
try:
user = await User.objects.get(email=credentials.email)
raise HTTPException(status_code=409, detail="User already registered")
except ormar.exceptions.NoMatch:
except Exception as exc:
import oxyde

if not isinstance(exc, oxyde.NotFoundError):
raise
pass
user = User(
email=credentials.email,
Expand Down Expand Up @@ -108,7 +111,8 @@ async def register(credentials: LoginInput, host=Header(default="")):
@api.post("/auth/verify", response_model=UserSafe, tags=["auth"])
async def verify(verification: Verification):
user = await decode(verification.verification)
await user.update(active=True)
user.active = True
await user.save(update_fields={"active"})
return user


Expand Down
Loading
Loading