diff --git a/estela-api/api/views/auth.py b/estela-api/api/views/auth.py index 8635da40..c4008ee7 100644 --- a/estela-api/api/views/auth.py +++ b/estela-api/api/views/auth.py @@ -102,13 +102,13 @@ def activate(self, request, *args, **kwargs): user = User.objects.filter(pk=user_id) if not user: return redirect( - settings.CORS_ORIGIN_WHITELIST[0], {"error": "User does not exist."} + settings.FRONTEND_HOST, {"error": "User does not exist."} ) user = user.get() if user.is_active: return redirect( - "".join([settings.CORS_ORIGIN_WHITELIST[0], "/activatedAccount"]), + "".join([settings.FRONTEND_HOST, "/activatedAccount"]), {"message": "Account already activated!"}, ) elif account_reset_token.check_token(user, token): @@ -129,7 +129,7 @@ def activate(self, request, *args, **kwargs): ) email.send() return redirect( - "".join([settings.CORS_ORIGIN_WHITELIST[0], "/activatedAccount"]), + "".join([settings.FRONTEND_HOST, "/activatedAccount"]), { "message": "Thank you for your email confirmation. You can now log in to your account." }, @@ -137,7 +137,7 @@ def activate(self, request, *args, **kwargs): else: self.retry_send_verification_email(user, request) return redirect( - settings.CORS_ORIGIN_WHITELIST[0], + settings.FRONTEND_HOST, {"message": "Activation link is invalid!"}, ) diff --git a/estela-api/config/settings/base.py b/estela-api/config/settings/base.py index 09ad40ff..b96f71fc 100644 --- a/estela-api/config/settings/base.py +++ b/estela-api/config/settings/base.py @@ -40,6 +40,7 @@ REDIS_URL=(str, "redis://redis"), REDIS_STATS_INTERVAL=(str, "5.0"), CORS_ORIGIN_WHITELIST=(str, "http://127.0.0.1:3000"), + DJANGO_FRONTEND_HOST=(str, "http://127.0.0.1:3000"), AWS_ACCESS_KEY_ID=(str, "dummy"), AWS_SECRET_ACCESS_KEY=(str, "dummy"), AWS_DEFAULT_REGION=(str, "us-east-2"), @@ -86,6 +87,7 @@ STAGE = env("STAGE") DJANGO_API_HOST = env("DJANGO_API_HOST") +FRONTEND_HOST = env("DJANGO_FRONTEND_HOST") ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS").split(",") DJANGO_EXTERNAL_APPS = [x for x in env("DJANGO_EXTERNAL_APPS").split(",") if x] diff --git a/estela-api/core/views.py b/estela-api/core/views.py index c2142146..1c679ad2 100644 --- a/estela-api/core/views.py +++ b/estela-api/core/views.py @@ -66,7 +66,7 @@ def send_verification_email(user, request): def send_change_password_email(user): mail_subject = "Change your estela password." to_email = user.email - estela_domain = settings.CORS_ORIGIN_WHITELIST[0] + estela_domain = settings.FRONTEND_HOST message = render_to_string( "change_password_email.html", { diff --git a/estela-web/src/pages/DeployListPage/index.tsx b/estela-web/src/pages/DeployListPage/index.tsx index 5b9bf58f..1a4aa75e 100644 --- a/estela-web/src/pages/DeployListPage/index.tsx +++ b/estela-web/src/pages/DeployListPage/index.tsx @@ -9,7 +9,7 @@ import WelcomeDeploy from "../../assets/images/welcomeDeploy.svg"; import "./styles.scss"; import { API_BASE_URL } from "../../constants"; -import { ApiService } from "../../services"; +import { ApiService, AuthService } from "../../services"; import { ApiProjectsDeploysListRequest, Deploy, UserDetail } from "../../services/api"; import { resourceNotAllowedNotification, Spin, PaginationItem } from "../../shared"; import { convertDateToString } from "../../utils"; @@ -280,7 +280,7 @@ export class DeployListPage extends Component,

$ cd quotesbot

$ estela login

Host [http://localhost]: {API_BASE_URL}

-

Username: admin

+

Username: {AuthService.getUserUsername()}

Password:

$ estela init {this.projectId}

$ estela deploy

@@ -297,7 +297,7 @@ export class DeployListPage extends Component,

$ cd <project_name>

$ estela login

Host [http://localhost]: {API_BASE_URL}

-

Username: admin

+

Username: {AuthService.getUserUsername()}

Password:

$ estela init {this.projectId}

$ estela deploy

diff --git a/estela-web/src/pages/RegisterPage/index.tsx b/estela-web/src/pages/RegisterPage/index.tsx index 52b1745d..01574110 100644 --- a/estela-web/src/pages/RegisterPage/index.tsx +++ b/estela-web/src/pages/RegisterPage/index.tsx @@ -76,6 +76,7 @@ export class RegisterPage extends Component { handleSubmit = (data: { email: string; username: string; password: string }): void => { this.setState({ loading: true }); if (!this.validatePassword(data.password)) { + this.setState({ loading: false }); return; } diff --git a/installation/helm-chart/templates/API/api-configmap.yaml b/installation/helm-chart/templates/API/api-configmap.yaml index 126c37c8..6d3e6762 100644 --- a/installation/helm-chart/templates/API/api-configmap.yaml +++ b/installation/helm-chart/templates/API/api-configmap.yaml @@ -28,6 +28,7 @@ data: VERIFICATION_EMAIL: {{ .Values.VERIFICATION_EMAIL }} REGISTER: {{ .Values.REGISTER | quote }} DJANGO_API_HOST: http://{{ .Values.DJANGO_API_HOST }} + DJANGO_FRONTEND_HOST: {{ .Values.DJANGO_FRONTEND_HOST }} DJANGO_ALLOWED_HOSTS: {{ .Values.DJANGO_API_HOST }},{{ .Values.DJANGO_ALLOWED_HOSTS }},127.0.0.1 STAGE: {{ .Values.STAGE }} DEDICATED_SPIDER_NODES: {{ .Values.DEDICATED_SPIDER_NODES | quote}}