Merge branch 'develop' into kostia/fix/basic_ui

This commit is contained in:
Kostiantyn Stoliarskyi 2023-04-20 17:31:08 +03:00
commit 0992d7bce8
11 changed files with 19 additions and 55 deletions

File diff suppressed because one or more lines are too long

View File

@ -24,23 +24,8 @@
{{form.password.label(class='block mb-2 text-sm font-medium text-gray-900 dark:text-white')}}
{{form.password(class='bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500')}}
</div>
<div class="flex items-start">
<div class="flex items-center h-5">
<!-- prettier-ignore -->
<input id="remember" aria-describedby="remember" name="remember" type="checkbox" class="w-4 h-4 border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:bg-gray-700 dark:border-gray-600" required/>
</div>
<div class="ml-3 text-sm">
<!-- prettier-ignore -->
<label for="remember" class="font-medium text-gray-500 dark:text-gray-400">Remember this device</label>
</div>
<!-- prettier-ignore -->
<a href="{{ url_for('auth.forgot_pass') }}" class="ml-auto text-sm font-medium text-blue-600 hover:underline dark:text-blue-500">Lost Password?</>
</div>
<!-- prettier-ignore -->
<button type="submit" class="w-full px-5 py-3 text-base font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 sm:w-auto dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Login to your account</button>
<!-- prettier-ignore -->
<div class="text-sm font-medium text-gray-900 dark:text-white">Not registered yet?<a class="text-blue-600 hover:underline dark:text-blue-500" href="{{ url_for('auth.register') }}" >Create account</a></div>
</form>
</div>
</div>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<title>{{ config.APP_NAME }}</title>
<!-- meta -->
<meta name="description" content="Simple2B Flask App" />
<meta name="description" content="OpenLaw Flask App" />
<meta name="author" content="Simple2B" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
@ -16,13 +16,13 @@
<script>
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
if (
localStorage.getItem("color-theme") === "dark" ||
(!("color-theme" in localStorage) &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
localStorage.getItem('color-theme') === 'dark' ||
(!('color-theme' in localStorage) &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.documentElement.classList.add("dark");
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove("dark");
document.documentElement.classList.remove('dark');
}
</script>
<!-- prettier-ignore -->

View File

@ -22,14 +22,14 @@
d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
</svg>
</button>
<a href="https://simple2b.com/" class="flex ml-2 md:mr-24">
<a href="#" class="flex ml-2 md:mr-24">
<img
src="{{url_for('static',filename='img/logo.svg')}}"
class="h-8 mr-3"
alt="Simple2b Logo" />
alt="OpenLaw Logo" />
<span
class="self-center text-xl font-semibold sm:text-2xl whitespace-nowrap dark:text-white"
>Simple2B</span
>OpenLaw</span
>
</a>
</div>

View File

@ -50,7 +50,8 @@
</li>
<li>
<a
href="https://github.com/Simple2B/flask.app"
href="https://github.com/Simple2B/open_law"
target="_blank"
class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
<svg
aria-hidden="true"

View File

@ -136,7 +136,6 @@
</div>
{% endif %}
</div>
{% include 'user/edit.html' %}
{% include 'user/add.html' %}
<!-- prettier-ignore -->
{% endblock %}

View File

@ -16,15 +16,6 @@ class BaseConfig(BaseSettings):
SQLALCHEMY_TRACK_MODIFICATIONS: bool = False
WTF_CSRF_ENABLED: bool = False
# Mail config
MAIL_SERVER: str
MAIL_PORT: int
MAIL_USE_TLS: bool
MAIL_USE_SSL: bool
MAIL_USERNAME: str
MAIL_PASSWORD: str
MAIL_DEFAULT_SENDER: str
# Super admin
ADMIN_USERNAME: str
ADMIN_EMAIL: str

View File

@ -16,20 +16,8 @@ DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGR
DEVEL_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:${LOCAL_DB_PORT}/${POSTGRES_DB}
# WEB app
LOCAL_WEB_PORT=8000
LOCAL_WEB_PORT=8080
# e-mail configuration
MAIL_USERNAME=admin@simple2b.com
MAIL_DEFAULT_SENDER=admin@simple2b.com
MAIL_PASSWORD="super secret"
MAIL_SERVER=mail.simple2b.com
MAIL_PORT=465
MAIL_USE_TLS=false
MAIL_USE_SSL=true
MAIL_USERNAME=user_name
MAIL_PASSWORD=set_password
MAIL_DEFAULT_SENDER=user@simple2b.com
# Super admin
ADMIN_USERNAME=admin

View File

@ -4,7 +4,7 @@ from flask.testing import FlaskClient
from app import create_app, db
from app import models as m
from tests.utils import register
from tests.utils import create
@pytest.fixture()
@ -27,7 +27,7 @@ def client(app: Flask):
db.drop_all()
db.create_all()
register()
create()
yield client
db.session.remove()

View File

@ -12,11 +12,11 @@ def test_auth_pages(client):
def test_login_and_logout(client):
# Access to logout view before login should fail.
response = login(client, "sam")
response = login(client)
assert b"Login successful." in response.data
# Incorrect login credentials should fail.
response = login(client, "sam", "wrongpassword")
assert b"Wrong user ID or password." in response.data
# Correct credentials should login
response = login(client, "sam")
response = login(client)
assert b"Login successful." in response.data

View File

@ -5,7 +5,7 @@ TEST_ADMIN_EMAIL = "bob@test.com"
TEST_ADMIN_PASSWORD = "password"
def register(
def create(
username=TEST_ADMIN_NAME, email=TEST_ADMIN_EMAIL, password=TEST_ADMIN_PASSWORD
):
user = User(username=username, email=email)