Skip to content

Commit 55165aa

Browse files
author
lijianguo
committed
Merge branch 'main' of github.com:drycc/passport into main
2 parents c0b61de + 0d942a5 commit 55165aa

18 files changed

Lines changed: 61 additions & 35 deletions

charts/passport/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ database_url: ""
1212
# can be specified as key-value pairs under environment
1313
# this is usually a non required setting.
1414
environment:
15+
## General settings
16+
# DRYCC_DEBUG: False
17+
# ADMIN_ENABLED: False
18+
# REGISTRATION_ENABLED: False
1519
## LDAP setting
1620
# LDAP_ENDPOINT: ""
1721
# LDAP_BIND_DN: ""
@@ -37,7 +41,6 @@ environment:
3741
# EMAIL_HOST_PASSWORD: ""
3842
# EMAIL_USE_TLS: ""
3943
# EMAIL_USE_SSL: ""
40-
# DEFAULT_FROM_EMAIL: ""
4144
# Used to create Django admin users
4245
admin_username: "admin"
4346
admin_password: "admin"

rootfs/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ WORKDIR /app
66
RUN npm install \
77
&& yarn build
88

9-
109
FROM docker.io/library/python:3.9-alpine
1110

1211
COPY requirements.txt /app/requirements.txt
@@ -20,12 +19,14 @@ RUN apk add --update --virtual .build-deps \
2019
openssl-dev \
2120
cargo \
2221
rust \
22+
&& python3 -m venv /app/.venv \
23+
&& source /app/.venv/bin/activate \
2324
&& pip3 install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
2425
&& runDeps="$( \
25-
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
26+
scanelf --needed --nobanner --format '%n#p' --recursive /app/.venv \
2627
| tr ',' '\n' \
2728
| sort -u \
28-
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
29+
| awk 'system("[ -e /app/.venv/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
2930
)" \
3031
&& apk add --update --virtual .passport-rundeps \
3132
$runDeps \
@@ -38,6 +39,7 @@ RUN apk add --update --virtual .build-deps \
3839
COPY . /app
3940
COPY --from=build-app /app/dist /app/web/dist
4041

42+
ENV PATH /app/.venv/bin:/app/bin:$PATH
4143
WORKDIR /app
4244
CMD ["/app/bin/boot"]
4345
EXPOSE 8000

rootfs/Dockerfile.test

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ COPY requirements.txt /app/requirements.txt
44
COPY dev_requirements.txt /app/dev_requirements.txt
55

66
ENV PGDATA /var/lib/postgresql/12
7+
8+
ENV PATH="/app/.venv/bin:${PATH}"
9+
710
RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositories \
811
&& apk add --update --virtual .build-deps \
912
postgresql-dev \
@@ -14,13 +17,15 @@ RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositor
1417
openssl-dev \
1518
cargo \
1619
rust \
20+
&& python3 -m venv /app/.venv \
21+
&& source /app/.venv/bin/activate \
1722
&& pip3 install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
1823
&& pip3 install --disable-pip-version-check --no-cache-dir -r /app/dev_requirements.txt \
1924
&& runDeps="$( \
20-
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
25+
scanelf --needed --nobanner --format '%n#p' --recursive /app/.venv \
2126
| tr ',' '\n' \
2227
| sort -u \
23-
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
28+
| awk 'system("[ -e /app/.venv/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
2429
)" \
2530
&& apk add --update --virtual .passport-rundeps \
2631
$runDeps \
@@ -39,6 +44,7 @@ RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositor
3944

4045
COPY . /app
4146

47+
ENV PATH /app/.venv/bin:/app/bin:$PATH
4248
WORKDIR /app
4349
CMD ["/app/bin/boot"]
4450
EXPOSE 8000

rootfs/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
logger = logging.getLogger(__name__)
1818

1919

20-
class RegisterForm(UserCreationForm):
20+
class RegistrationForm(UserCreationForm):
2121
class Meta(UserCreationForm.Meta):
2222
model = User
2323
fields = ('username', 'email', 'password1', 'password2')

rootfs/api/settings/production.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@
1414

1515
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1616
# SECURITY WARNING: don't run with debug turned on in production!
17-
DEBUG = bool(os.environ.get('DRYCC_DEBUG', True))
17+
DEBUG = bool(os.environ.get('DRYCC_DEBUG', False))
1818

1919
# If set to True, Django's normal exception handling of view functions
2020
# will be suppressed, and exceptions will propagate upwards
2121
# https://docs.djangoproject.com/en/2.2/ref/settings/#debug-propagate-exceptions
2222
DEBUG_PROPAGATE_EXCEPTIONS = True
2323
# Enable Django admin
2424
ADMIN_ENABLED = bool(os.environ.get('ADMIN_ENABLED', False))
25+
# Enable Registration
26+
# If this function is enabled, please set Django email related parameters
27+
REGISTRATION_ENABLED = bool(os.environ.get('REGISTRATION_ENABLED', False))
2528
# Silence two security messages around SSL as router takes care of them
2629
# https://docs.djangoproject.com/en/2.2/ref/checks/#security
2730
SILENCED_SYSTEM_CHECKS = [
@@ -91,6 +94,7 @@
9194

9295
INSTALLED_APPS = (
9396
'whitenoise.runserver_nostatic',
97+
'django.contrib.staticfiles',
9498
'django.contrib.admin',
9599
'django.contrib.auth',
96100
'django.contrib.contenttypes',
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ h1.logo a {
3636
height: 98px;
3737
width: 69px;
3838
overflow: hidden;
39-
/*登录页logo图标*/
40-
/*background: url(../logo-vertical.png);*/
4139
background-repeat: no-repeat
4240
}
4341

rootfs/api/templates/oauth2_provider/authorize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% load i18n %}
22
{% load static %}
3-
<link rel="stylesheet" href="{% static 'css/user.css' %}" type="text/css">
3+
<link rel="stylesheet" href="{% static 'css/main.css' %}" type="text/css">
44
<head>
55
<meta charset="UTF-8">
66
<title>Change Password</title>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends 'user/message.html' %}
22
{% block title %}Account activite fail{% endblock %}
33
{% block message %}
4-
The confirmation link was invalid, possibly it has already been used, go back <a href="/user/register/">register</a>
4+
The confirmation link was invalid, possibly it has already been used, go back <a href="/user/registration/">Sign Up</a>
55
{% endblock %}

rootfs/api/templates/user/login.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% load static %}
22

3-
<link rel="stylesheet" href="{% static 'css/user.css' %}" type="text/css">
3+
<link rel="stylesheet" href="{% static 'css/main.css' %}" type="text/css">
44
<head>
55
<meta charset="UTF-8">
66
<title>Login</title>
@@ -26,7 +26,7 @@ <h2 class="h3">Log in to your account</h2>
2626
<button class="btn btn-primary btn-lg btn-block" name="commit" type="submit">Log In</button>
2727
<input type="hidden" name="next" value={{ next }}>
2828
</form>
29-
<a class="panel-footer" href="/user/register/"><span>Sign Up</span></a>
29+
<a class="panel-footer" href="/user/registration/"><span>Sign Up</span></a>
3030
</div>
3131
<a href="/user/password_reset/" class="white-link">Forgot your password?</a>
3232
</div>

rootfs/api/templates/user/message.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% load static %}
22

3-
<link rel="stylesheet" href="{% static 'css/user.css' %}" type="text/css">
3+
<link rel="stylesheet" href="{% static 'css/main.css' %}" type="text/css">
44

55
<head>
66
<meta charset="UTF-8">

0 commit comments

Comments
 (0)