Spaces:
Sleeping
Sleeping
FauziIsyrinApridal
commited on
Commit
·
950f1d6
1
Parent(s):
74b3593
revisi 12
Browse files- .env.example +3 -0
- app/auth.py +4 -4
.env.example
CHANGED
@@ -4,6 +4,9 @@ SUPABASE_URL=
|
|
4 |
SUPABASE_KEY=
|
5 |
SUPABASE_STORAGE_BUCKET=
|
6 |
|
|
|
|
|
|
|
7 |
|
8 |
HUGGINGFACEHUB_API_TOKEN=
|
9 |
LANGSMITH_TRACING=
|
|
|
4 |
SUPABASE_KEY=
|
5 |
SUPABASE_STORAGE_BUCKET=
|
6 |
|
7 |
+
# Email redirect URL for Supabase auth (registration & password reset)
|
8 |
+
SUPABASE_EMAIL_REDIRECT=https://yozora721-pnp-chatbot-v1.hf.space
|
9 |
+
NEXT_PUBLIC_SITE_URL=https://yozora721-pnp-chatbot-v1.hf.space
|
10 |
|
11 |
HUGGINGFACEHUB_API_TOKEN=
|
12 |
LANGSMITH_TRACING=
|
app/auth.py
CHANGED
@@ -136,10 +136,10 @@ def auth_view():
|
|
136 |
st.error("Password tidak sama.")
|
137 |
else:
|
138 |
try:
|
139 |
-
# Prefer explicit env, then generic site URL, then
|
140 |
redirect_url = os.getenv(
|
141 |
"SUPABASE_EMAIL_REDIRECT",
|
142 |
-
os.getenv("NEXT_PUBLIC_SITE_URL", "
|
143 |
)
|
144 |
supabase.auth.sign_up({
|
145 |
"email": r_email,
|
@@ -157,10 +157,10 @@ def auth_view():
|
|
157 |
submitted_f = st.form_submit_button("Kirim Link Reset")
|
158 |
if submitted_f:
|
159 |
try:
|
160 |
-
# Prefer explicit env, then generic site URL, then
|
161 |
redirect_url = os.getenv(
|
162 |
"SUPABASE_EMAIL_REDIRECT",
|
163 |
-
os.getenv("NEXT_PUBLIC_SITE_URL", "
|
164 |
)
|
165 |
supabase.auth.reset_password_for_email(f_email, {"redirect_to": redirect_url})
|
166 |
st.success("Email reset password telah dikirim. Periksa kotak masuk Anda.")
|
|
|
136 |
st.error("Password tidak sama.")
|
137 |
else:
|
138 |
try:
|
139 |
+
# Prefer explicit env, then generic site URL, then production URL
|
140 |
redirect_url = os.getenv(
|
141 |
"SUPABASE_EMAIL_REDIRECT",
|
142 |
+
os.getenv("NEXT_PUBLIC_SITE_URL", "https://yozora721-pnp-chatbot-v1.hf.space"),
|
143 |
)
|
144 |
supabase.auth.sign_up({
|
145 |
"email": r_email,
|
|
|
157 |
submitted_f = st.form_submit_button("Kirim Link Reset")
|
158 |
if submitted_f:
|
159 |
try:
|
160 |
+
# Prefer explicit env, then generic site URL, then production URL
|
161 |
redirect_url = os.getenv(
|
162 |
"SUPABASE_EMAIL_REDIRECT",
|
163 |
+
os.getenv("NEXT_PUBLIC_SITE_URL", "https://yozora721-pnp-chatbot-v1.hf.space"),
|
164 |
)
|
165 |
supabase.auth.reset_password_for_email(f_email, {"redirect_to": redirect_url})
|
166 |
st.success("Email reset password telah dikirim. Periksa kotak masuk Anda.")
|