Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Commit

Permalink
Some Updates (#10)
Browse files Browse the repository at this point in the history
* Update Logo

* Fixes docker-compose up on Windows

* A Lot of changes

* More Changes

Signed-off-by: Lobo Metalúrgico <43734867+LoboMetalurgico@users.noreply.github.com>

* Fix

* Another Fix

* Re-add volume

* Remove a \t which is breaking docker-compose

* Try 1

* Revert "Try 1"

* Update

* Rename the field Minecraft Username and fix SSO links

* Fixes docker-compose database persistence

* Try II

* Fix Css and logo

* Readd grayscale

* Update favicon

* Replace some Sponge references and e-mail settings

* Fixes e-mails and TOS url

* Fix Test

* Fix email

* Fix lint

* Update Header

* Implement redis and other fixes

* add password in redis + fix git actions

* Fix lint error

* Change max-line-length to 125

* Change all references from DiscordID to DiscordTag

* Pullbot

* Bump faker from 7.0.1 to 8.0.0 in /requirements

Bumps [faker](https://github.com/joke2k/faker) from 7.0.1 to 8.0.0.
- [Release notes](https://github.com/joke2k/faker/releases)
- [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md)
- [Commits](joke2k/faker@v7.0.1...v8.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump django from 3.1.7 to 3.2 in /requirements

Bumps [django](https://github.com/django/django) from 3.1.7 to 3.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](django/django@3.1.7...3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump pre-commit from 2.11.1 to 2.12.0 in /requirements

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.11.1 to 2.12.0.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v2.11.1...v2.12.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/core from 7.13.14 to 7.13.15

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.13.14 to 7.13.15.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.15/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/preset-env from 7.13.12 to 7.13.15

Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.13.12 to 7.13.15.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.15/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump pytest-django from 4.1.0 to 4.2.0 in /requirements

Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](pytest-dev/pytest-django@v4.1.0...v4.2.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google-closure-compiler from 20210302.0.0 to 20210406.0.0

Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20210302.0.0 to 20210406.0.0.
- [Release notes](https://github.com/google/closure-compiler-npm/releases)
- [Commits](google/closure-compiler-npm@v20210302.0.0...v20210406.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump faker from 8.0.0 to 8.1.0 in /requirements

Bumps [faker](https://github.com/joke2k/faker) from 8.0.0 to 8.1.0.
- [Release notes](https://github.com/joke2k/faker/releases)
- [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md)
- [Commits](joke2k/faker@v8.0.0...v8.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump django-debug-toolbar from 3.2 to 3.2.1 in /requirements

Bumps [django-debug-toolbar](https://github.com/jazzband/django-debug-toolbar) from 3.2 to 3.2.1.
- [Release notes](https://github.com/jazzband/django-debug-toolbar/releases)
- [Changelog](https://github.com/jazzband/django-debug-toolbar/blob/main/docs/changes.rst)
- [Commits](jazzband/django-debug-toolbar@3.2...3.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump pre-commit from 2.12.0 to 2.12.1 in /requirements

Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/pre-commit/pre-commit/releases)
- [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md)
- [Commits](pre-commit/pre-commit@v2.12.0...v2.12.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/register from 7.13.14 to 7.13.16

Bumps [@babel/register](https://github.com/babel/babel/tree/HEAD/packages/babel-register) from 7.13.14 to 7.13.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.16/packages/babel-register)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/core from 7.13.15 to 7.13.16

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.13.15 to 7.13.16.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.16/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump black from 20.8b1 to 21.4b0 in /requirements

Bumps [black](https://github.com/psf/black) from 20.8b1 to 21.4b0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump faker from 8.1.0 to 8.1.1 in /requirements

Bumps [faker](https://github.com/joke2k/faker) from 8.1.0 to 8.1.1.
- [Release notes](https://github.com/joke2k/faker/releases)
- [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md)
- [Commits](joke2k/faker@v8.1.0...v8.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump black from 21.4b0 to 21.4b1 in /requirements

Bumps [black](https://github.com/psf/black) from 21.4b0 to 21.4b1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump black from 21.4b1 to 21.4b2 in /requirements

Bumps [black](https://github.com/psf/black) from 21.4b1 to 21.4b2.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump faker from 8.1.1 to 8.1.2 in /requirements

Bumps [faker](https://github.com/joke2k/faker) from 8.1.1 to 8.1.2.
- [Release notes](https://github.com/joke2k/faker/releases)
- [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md)
- [Commits](joke2k/faker@v8.1.1...v8.1.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/core from 7.13.16 to 7.14.0

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.13.16 to 7.14.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.0/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/preset-env from 7.13.15 to 7.14.0

Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.13.15 to 7.14.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.0/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/preset-env from 7.14.0 to 7.14.1

Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.14.0 to 7.14.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.1/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump black from 21.4b2 to 21.5b0 in /requirements

Bumps [black](https://github.com/psf/black) from 21.4b2 to 21.5b0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump django from 3.2 to 3.2.1 in /requirements

Bumps [django](https://github.com/django/django) from 3.2 to 3.2.1.
- [Release notes](https://github.com/django/django/releases)
- [Commits](django/django@3.2...3.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump lodash from 4.17.19 to 4.17.21

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump django from 3.2.1 to 3.2.2 in /requirements

Bumps [django](https://github.com/django/django) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](django/django@3.2.1...3.2.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump sentry-sdk from 1.0.0 to 1.1.0 in /requirements

Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/getsentry/sentry-python/releases)
- [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-python@1.0.0...1.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump google-closure-compiler from 20210406.0.0 to 20210505.0.0

Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20210406.0.0 to 20210505.0.0.
- [Release notes](https://github.com/google/closure-compiler-npm/releases)
- [Commits](google/closure-compiler-npm@v20210406.0.0...v20210505.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump hosted-git-info from 2.8.8 to 2.8.9

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](npm/hosted-git-info@v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump faker from 8.1.2 to 8.1.3 in /requirements

Bumps [faker](https://github.com/joke2k/faker) from 8.1.2 to 8.1.3.
- [Release notes](https://github.com/joke2k/faker/releases)
- [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md)
- [Commits](joke2k/faker@v8.1.2...v8.1.3)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump black from 21.5b0 to 21.5b1 in /requirements

Bumps [black](https://github.com/psf/black) from 21.5b0 to 21.5b1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/core from 7.14.0 to 7.14.2

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.14.0 to 7.14.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.2/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/preset-env from 7.14.1 to 7.14.2

Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.14.1 to 7.14.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.2/packages/babel-preset-env)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump faker from 8.1.3 to 8.1.4 in /requirements

Bumps [faker](https://github.com/joke2k/faker) from 8.1.3 to 8.1.4.
- [Release notes](https://github.com/joke2k/faker/releases)
- [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md)
- [Commits](joke2k/faker@v8.1.3...v8.1.4)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump django from 3.2.2 to 3.2.3 in /requirements

Bumps [django](https://github.com/django/django) from 3.2.2 to 3.2.3.
- [Release notes](https://github.com/django/django/releases)
- [Commits](django/django@3.2.2...3.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump pytest-django from 4.2.0 to 4.3.0 in /requirements

Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](pytest-dev/pytest-django@v4.2.0...v4.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump pytest-cov from 2.11.1 to 2.12.0 in /requirements

Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.11.1 to 2.12.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](pytest-dev/pytest-cov@v2.11.1...v2.12.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump @babel/core from 7.14.2 to 7.14.3

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.14.2 to 7.14.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.3/packages/babel-core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: joserobjr <joserobjr@powernukkit.org>
Co-authored-by: joserobjr <joserobjr@gamemods.com.br>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
4 people committed May 18, 2021
1 parent 5afc87e commit c6c3872
Show file tree
Hide file tree
Showing 47 changed files with 1,013 additions and 466 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf
*.java text eol=lf
*.md text eol=lf
*.xml text eol=lf
*.yml text eol=lf
*.ini text=auto
*.txt text=auto
*.bat text eol=crlf
*.cmd text eol=crlf
*.sh text eol=lf
*.dat binary
*.jar binary
*.class binary
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
test:

runs-on: ubuntu-latest
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [ '3.x' ]
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN apt-get update \
postgresql-client \
libpq-dev \
git \
nano \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& npm install npm@latest -g
Expand All @@ -34,6 +36,9 @@ RUN npm install \

COPY . /app

ENV DJANGO_SETTINGS_MODULE=spongeauth.settings.docker
RUN node_modules/.bin/gulp build \
&& chmod 777 /app/entrypoint/run.sh

CMD ["/app/hack/run.sh"]
ENV DJANGO_SETTINGS_MODULE=spongeauth.settings.dev

CMD ["/app/entrypoint/run.sh"]
24 changes: 23 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
db:
image: postgres:9.6
volumes:
- spongeauth-db:/var/lib/postgresql
- spongeauth-db:/var/lib/postgresql/data
environment:
POSTGRES_USER: spongeauth
POSTGRES_PASSWORD: spongeauth
Expand All @@ -16,12 +16,34 @@ services:
image: mailhog/mailhog:latest
ports:
- "8025:8025"
redis:
image: redis:6.0.6
command: redis-server --requirepass changeme
app:
build: .
ports:
- "8000:8000"
links:
- "db"
- "mail"
- "redis"
environment:
EMAIL_HOST_USER: email@username.com
EMAIL_HOST_PASSWORD: "PasswordForEmail"
EMAIL_HOST: smtp.for.email.com
EMAIL_HOST_PORT: 587
SECRET: changeme
SECRET_KEY: changeme
DB_NAME: spongeauth
DB_USER: spongeauth
DB_PASSWORD: spongeauth
DB_HOST: db
DJANGO_SETTINGS_MODULE: spongeauth.settings.prod
DJANGO_SETTINGS_SKIP_LOCAL: "True"
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: changeme
REDIS_DEFAULT_TIMEOUT: 300
DEBUG: "True"
volumes:
- .:/app
File renamed without changes.
884 changes: 568 additions & 316 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "spongeauth",
"name": "oreauth",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/SpongePowered/SpongeAuth.git",
"author": "The SpongePowered Team",
"repository": "https://github.com/PowerNukkit/OreAuth.git",
"author": "The PowerNukkit Ore Team",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.13.14",
"@babel/preset-env": "^7.13.12",
"@babel/register": "^7.13.14",
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@babel/register": "^7.13.16",
"bootstrap-sass": "3.4.1",
"font-awesome": "^4.7.0",
"google-closure-compiler": "^20210302.0.0",
"google-closure-compiler": "^20210505.0.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^4.3.0",
Expand Down
2 changes: 1 addition & 1 deletion prospector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pep8:
disable:
- E203
options:
max-line-length: 120
max-line-length: 125

mccabe:
run: false
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tool.black]
line-length = 120
line-length = 125
target-version = ["py37"]
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==3.1.7
Django==3.2.3
-e git+https://github.com/lukegb/django-user-sessions.git#egg=django-user-sessions
Pillow==8.2.0
oauth2client==4.1.3
Expand Down
10 changes: 5 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-r base.txt

pytest-django==4.1.0
pytest-django==4.3.0
prospector==1.3.1
factory_boy==3.2.0
Faker==7.0.1
django-debug-toolbar==3.2
Faker==8.1.4
django-debug-toolbar==3.2.1
pylint==2.5.3
black==20.8b1
pre-commit==2.11.1
black==21.5b1
pre-commit==2.12.1
fakeredis==1.5.0
2 changes: 1 addition & 1 deletion requirements/prod.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r base.txt

sentry-sdk==1.0.0
sentry-sdk==1.1.0
gunicorn==20.1.0
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r dev.txt

coveralls==3.0.1
pytest-cov==2.11.1
pytest-cov==2.12.0
14 changes: 7 additions & 7 deletions spongeauth/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ProfileFieldsMixin(forms.Form):
label=_("Full Name"), max_length=255, required=False, help_text=_("Enter your full name here")
)
mc_username = forms.CharField(
label=_("Minecraft Username"),
label=_("XBox GameTag"),
max_length=255,
required=False,
help_text=_("Enter the username you use for Minecraft here"),
Expand All @@ -58,12 +58,12 @@ class ProfileFieldsMixin(forms.Form):
required=False,
help_text=_("Publish your software on GitHub? " "Enter your GitHub username here"),
)
discord_id = forms.CharField(
label=_("Discord ID"),
discord_tag = forms.CharField(
label=_("Discord Tag"),
max_length=255,
required=False,
help_text=_("You're using Discord?" "Enter your Discord ID here"),
validators=[models.validate_discord_id],
help_text=_("You're using Discord? " "Enter your Discord Tag here"),
validators=[models.validate_discord_tag],
)


Expand Down Expand Up @@ -137,7 +137,7 @@ def __init__(self, *args, **kwargs):
Field("mc_username"),
Field("irc_nick"),
Field("gh_username"),
Field("discord_id"),
Field("discord_tag"),
]
for field in getattr(self, "tos_fields", {}).keys():
fields.append(Field(field))
Expand Down Expand Up @@ -251,7 +251,7 @@ def __init__(self, *args, **kwargs):

class Meta:
model = models.User
fields = ["full_name", "mc_username", "irc_nick", "gh_username", "discord_id"]
fields = ["full_name", "mc_username", "irc_nick", "gh_username", "discord_tag"]


class ChangePasswordForm(forms.Form):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def create_tos(apps, schema_editor):
tos = TermsOfService(
name="SpongePowered Terms of Service (2018-03-10)",
tos_date=datetime.date(2018, 3, 10),
tos_url="https://docs.spongepowered.org/stable/en/about/tos.html",
tos_url="https://powernukkit.org/terms",
current_tos=True,
)
tos.save(using=db_alias)
Expand Down
4 changes: 2 additions & 2 deletions spongeauth/accounts/migrations/0013_user_discord_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name="user",
name="discord_id",
name="discord_tag",
field=models.CharField(
blank=True, max_length=255, validators=[accounts.models.validate_discord_id], verbose_name="Discord ID"
blank=True, max_length=255, validators=[accounts.models.validate_discord_tag], verbose_name="Discord Tag"
),
)
]
16 changes: 9 additions & 7 deletions spongeauth/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ def validate_username(username):
errs = []
if len(username) < 3:
errs.append(ValidationError(_("Username must be at least 3 characters long."), code="username_min_length"))
if re.search(r"[^\w.-]", username):
if re.search(r"[^\w\.\-]", username):
errs.append(
ValidationError(_("Username must only include numbers, letters, and underscores."), code="username_charset")
ValidationError(
_("Username must only include numbers, letters, hyphens, dots, and underscores."), code="username_charset"
)
)
if re.search(r"\W", username[0]):
errs.append(
Expand All @@ -47,9 +49,9 @@ def validate_username(username):
raise ValidationError(errs)


def validate_discord_id(discord_id):
if not re.match(r"^(.+)#(\d{4})$", discord_id):
raise ValidationError("The Discord ID has to match the pattern username#1234.", "wrong_pattern")
def validate_discord_tag(discord_tag):
if not re.match(r"^(.+)#(\d{4})$", discord_tag):
raise ValidationError("The Discord Tag has to match the pattern username#1234.", "wrong_pattern")


class Group(models.Model):
Expand Down Expand Up @@ -96,8 +98,8 @@ class User(AbstractBaseUser):
mc_username = models.CharField(max_length=255, blank=True, null=True, verbose_name=_("Minecraft Username"))
irc_nick = models.CharField(max_length=255, blank=True, null=True, verbose_name=_("IRC Nick"))
gh_username = models.CharField(max_length=255, blank=True, null=True, verbose_name=_("GitHub Username"))
discord_id = models.CharField(
max_length=255, blank=True, null=False, verbose_name=_("Discord ID"), validators=[validate_discord_id]
discord_tag = models.CharField(
max_length=255, blank=True, null=False, verbose_name=_("Discord Tag"), validators=[validate_discord_tag]
)

joined_at = models.DateTimeField(auto_now_add=True, null=False, blank=False)
Expand Down
2 changes: 1 addition & 1 deletion spongeauth/accounts/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Meta:
mc_username = factory.Faker("user_name")
gh_username = factory.Faker("user_name")
irc_nick = factory.Faker("user_name")
discord_id = "user_name#1234"
discord_tag = "user_name#1234"

joined_at = factory.Faker("date_time_this_decade")

Expand Down
6 changes: 3 additions & 3 deletions spongeauth/accounts/tests/test_discord_id_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def test_validate_username(test_input, expected):
got = set()
try:
accounts.models.validate_discord_id(test_input)
accounts.models.validate_discord_tag(test_input)
except django.core.exceptions.ValidationError as err:
for suberr in err.error_list:
got.add(suberr.code)
Expand All @@ -30,9 +30,9 @@ def test_validate_username(test_input, expected):
def test_validate_username_model(test_input, expected):
got = set()
try:
user = accounts.tests.factories.UserFactory.build(discord_id=test_input)
user = accounts.tests.factories.UserFactory.build(discord_tag=test_input)
user.clean_fields()
except django.core.exceptions.ValidationError as err:
for suberr in err.error_dict["discord_id"]:
for suberr in err.error_dict["discord_tag"]:
got.add(suberr.code)
assert got == set(expected)
2 changes: 1 addition & 1 deletion spongeauth/accounts/tests/test_letter_avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ def test_colours(username, expected):
def test_get_absolute_url():
av = letter_avatar.LetterAvatar("sAlaMi")
assert av.get_absolute_url() == (
"https://forums-cdn.spongepowered.org/letter_avatar_proxy/" "v2/letter/s/f05b48/240.png"
"https://discuss.powernukkit.org/letter_avatar_proxy/" "v2/letter/s/f05b48/240.png"
)
4 changes: 2 additions & 2 deletions spongeauth/accounts/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ def test_create_user(self):
password="exciting",
full_name="Foo Bar",
mc_username="bar",
discord_id="foobar#1234",
discord_tag="foobar#1234",
)
assert isinstance(user, models.User)
assert user.username == "foo"
assert user.email == "foo@example.com"
assert user.full_name == "Foo Bar"
assert user.mc_username == "bar"
assert user.discord_id == "foobar#1234"
assert user.discord_tag == "foobar#1234"
assert not user.is_admin

assert user.password != "exciting"
Expand Down
16 changes: 8 additions & 8 deletions spongeauth/accounts/tests/test_view_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ def test_send_verify_email(mock_token_generator, mock_send_mail, mock_render_to_
user = factories.UserFactory.build()
views._send_verify_email(request, user)
mock_send_mail.assert_called_once_with(
"[Sponge] Confirm your email address",
"[Ore] Confirm your email address",
"accounts/verify/email.txt",
"admin@spongepowered.org",
"auth@powernukkit.org",
[user.email],
html_message="accounts/verify/email.html",
)
Expand All @@ -226,9 +226,9 @@ def test_send_forgot_email(mock_token_generator, mock_send_mail, mock_render_to_
user = factories.UserFactory.build()
views._send_forgot_email(request, user)
mock_send_mail.assert_called_once_with(
"[Sponge] Reset your password",
"[Ore] Reset your password",
"accounts/forgot/email.txt",
"admin@spongepowered.org",
"auth@powernukkit.org",
[user.email],
html_message="accounts/forgot/email.html",
)
Expand All @@ -249,9 +249,9 @@ def test_send_change_email(mock_token_generator, mock_send_mail, mock_render_to_
user = factories.UserFactory.build()
views._send_change_email(request, user, "new-email@example.com")
mock_send_mail.assert_called_once_with(
"[Sponge] Confirm your new email address",
"[Ore] Confirm your new email address",
"accounts/change_email/email.txt",
"admin@spongepowered.org",
"auth@powernukkit.org",
["new-email@example.com"],
html_message="accounts/change_email/email.html",
)
Expand All @@ -272,9 +272,9 @@ def test_send_email_changed_email(mock_send_mail, mock_render_to_string):
user = factories.UserFactory.build()
views._send_email_changed_email(request, user, "old-email@example.com")
mock_send_mail.assert_called_once_with(
"[Sponge] Your email address has been changed",
"[Ore] Your email address has been changed",
"accounts/change_email/confirmation_email.txt",
"admin@spongepowered.org",
"auth@powernukkit.org",
["old-email@example.com"],
html_message="accounts/change_email/confirmation_email.html",
)
Expand Down
Loading

0 comments on commit c6c3872

Please sign in to comment.