Author SHA1 Message Date
ahp ea821ff70b feat(web): show/hide toggle on the login password field
- an eye button inside the password field switches it between hidden
  and plain text; it is labelled for screen readers, exposes its state
  with aria-pressed and resets when the sign-in mode changes
- the field stays LTR, so the button sits at its right edge in both
  languages
2026-11-26 17:58:21 +03:30
9 changed files with 49 additions and 46 deletions

No files matched your search

-1
View File
@@ -1,6 +1,5 @@
# Sokhan configuration
# Copy this file to .env and adjust the values.
# For docker compose, copy it to deploy/.env instead.
# Every variable below has a working default for local development.
# --- Core ---
+1 -13
View File
@@ -5,19 +5,6 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) and the proje
## [Unreleased]
### Fixed
- Compose: the Whisper model cache now lives on the `sokhan-data` volume
(`HF_HOME=/data/huggingface`). Previously it sat in the container's own
filesystem, so every recreate (`down`/`up`, `--build`, a new image)
re-downloaded the weights — and transcription failed outright where the
Hugging Face Hub is unreachable.
- Compose: the postgres healthcheck probes the configured `POSTGRES_USER` and
`POSTGRES_DB` instead of a hardcoded `sokhan`.
- Quickstart (both READMEs) and `.env.example` now say to copy the env file to
`deploy/.env`; the missing-password error names that path too. Copying it to
the repo root left `POSTGRES_PASSWORD` unset for compose.
### Added
- **Persian accuracy stack (v2)** — measured on the 12-clip Common Voice
@@ -64,6 +51,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) and the proje
worker with timestamp-midpoint trimming, enabling the progress stream
and duration caps: 30 min on WebGPU, 10 min on WASM, 60 MB per file —
no input can wedge the demo at an eternal "processing" state anymore.
- A show/hide toggle (eye icon) on the login page's password field.
### Changed
+1 -5
View File
@@ -145,8 +145,6 @@ faster-whisper، یک ورکر Celery، یک داشبورد Next.js که فار
```bash
git clone https://github.com/Abolfazlrwm/sokhan.git
cd sokhan
cp .env.example deploy/.env # compose فایل .env کنار فایل compose را می‌خواند
# در deploy/.env مقدار POSTGRES_PASSWORD را یک رمز طولانی و تصادفی بگذارید
docker compose -f deploy/docker-compose.yml up -d --build
```
@@ -154,9 +152,7 @@ docker compose -f deploy/docker-compose.yml up -d --build
- API و مستندات: http://localhost:8000/docs
ورکر مدل Whisper تنظیم‌شده را در اولین رونویسی دانلود می‌کند
(`WHISPER_MODEL_SIZE`، پیش‌فرض `small`) و آن را روی ولوم `sokhan-data`
(`HF_HOME=/data/huggingface`) نگه می‌دارد، پس ساخت دوبارهٔ کانتینرها مدل را
دوباره دانلود نمی‌کند. برای فعال‌کردن خلاصه‌سازی،
(`WHISPER_MODEL_SIZE`، پیش‌فرض `small`). برای فعال‌کردن خلاصه‌سازی،
`SUMMARY_ENABLED=true` و متغیرهای LLM خود را در فایل `.env` کنار
`docker-compose.yml` بگذارید. برای اعمال مهاجرت‌های اسکیما به‌صورت دستی:
+1 -5
View File
@@ -143,8 +143,6 @@ default — a GPU is not required.
```bash
git clone https://github.com/Abolfazlrwm/sokhan.git
cd sokhan
cp .env.example deploy/.env # compose reads the .env next to the compose file
# edit deploy/.env and set POSTGRES_PASSWORD to a long random value
docker compose -f deploy/docker-compose.yml up -d --build
```
@@ -152,9 +150,7 @@ docker compose -f deploy/docker-compose.yml up -d --build
- API and docs: http://localhost:8000/docs
The worker downloads the configured Whisper model on first transcription
(`WHISPER_MODEL_SIZE`, default `small`) and caches it on the `sokhan-data`
volume (`HF_HOME=/data/huggingface`), so recreating the containers does not
download it again. To enable summaries, set
(`WHISPER_MODEL_SIZE`, default `small`). To enable summaries, set
`SUMMARY_ENABLED=true` and your LLM variables in a `.env` file next to
`docker-compose.yml`. To apply schema migrations manually:
+3 -3
View File
@@ -12,9 +12,9 @@ COPY alembic ./alembic
RUN pip install --no-cache-dir .
RUN useradd --system --uid 1000 --create-home appuser \
&& mkdir -p /data/audio \
&& chown -R appuser:appuser /data
# Non-root runtime user; uvicorn binds 8000 (unprivileged) and the app keeps
# no local writable state (postgres via DATABASE_URL).
RUN useradd --system --uid 1000 --create-home appuser
USER appuser
EXPOSE 8000
+3 -4
View File
@@ -5,12 +5,12 @@ services:
POSTGRES_USER: ${POSTGRES_USER:-sokhan}
# Required on purpose: shipping a default credential means every
# deployment that forgets the .env runs an open database.
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (cp .env.example deploy/.env and edit it)}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}
POSTGRES_DB: ${POSTGRES_DB:-sokhan}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
test: ["CMD-SHELL", "pg_isready -U sokhan"]
interval: 5s
timeout: 3s
retries: 10
@@ -33,11 +33,10 @@ services:
build:
context: ../backend
environment: &backend-env
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-sokhan}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (cp .env.example deploy/.env and edit it)}@postgres:5432/${POSTGRES_DB:-sokhan}
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-sokhan}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}@postgres:5432/${POSTGRES_DB:-sokhan}
REDIS_URL: redis://redis:6379/0
CELERY_ENABLED: "true"
DATA_DIR: /data
HF_HOME: /data/huggingface
SOKHAN_CORS_ORIGINS: ${SOKHAN_CORS_ORIGINS:-}
WHISPER_MODEL_SIZE: ${WHISPER_MODEL_SIZE:-medium}
WHISPER_DEVICE: ${WHISPER_DEVICE:-cpu}
+2
View File
@@ -53,6 +53,8 @@
"emailPlaceholder": "you@example.com",
"passwordLabel": "Password",
"passwordPlaceholder": "••••••••",
"showPassword": "Show password",
"hidePassword": "Hide password",
"codeLabel": "Connect code",
"codePlaceholder": "Enter your connect code",
"codeHint": "Have a connect code? No email or password needed.",
+2
View File
@@ -53,6 +53,8 @@
"emailPlaceholder": "you@example.com",
"passwordLabel": "رمز عبور",
"passwordPlaceholder": "••••••••",
"showPassword": "نمایش رمز عبور",
"hidePassword": "پنهان کردن رمز عبور",
"codeLabel": "کد اتصال",
"codePlaceholder": "کد اتصال را وارد کن",
"codeHint": "اگر کد اتصال داری، لازم نیست ایمیل و رمز عبور وارد کنی.",
+36 -15
View File
@@ -2,6 +2,7 @@
import { useState, type FormEvent } from "react";
import { useTranslations } from "next-intl";
import { Eye, EyeOff } from "lucide-react";
import { useRouter } from "@/i18n/navigation";
import { ApiError, login, register, setToken, tokenLogin } from "@/lib/api";
@@ -17,6 +18,7 @@ export default function LoginPage() {
const [mode, setMode] = useState<Mode>("login");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [code, setCode] = useState("");
const [emailError, setEmailError] = useState<string | null>(null);
const [passwordError, setPasswordError] = useState<string | null>(null);
@@ -27,6 +29,7 @@ export default function LoginPage() {
function switchMode(next: Mode) {
if (next === mode) return;
setMode(next);
setShowPassword(false);
setEmailError(null);
setPasswordError(null);
setCodeError(null);
@@ -176,21 +179,39 @@ export default function LoginPage() {
>
{t("passwordLabel")}
</label>
<input
id="login-password"
name="password"
type="password"
dir="ltr"
autoComplete={mode === "register" ? "new-password" : "current-password"}
value={password}
onChange={(event) => {
setPassword(event.target.value);
if (passwordError) setPasswordError(null);
}}
placeholder={t("passwordPlaceholder")}
aria-invalid={passwordError ? true : undefined}
className={inputClasses}
/>
{/* The field is always LTR, so the toggle sits at its physical right. */}
<div className="relative" dir="ltr">
<input
id="login-password"
name="password"
type={showPassword ? "text" : "password"}
dir="ltr"
autoComplete={mode === "register" ? "new-password" : "current-password"}
value={password}
onChange={(event) => {
setPassword(event.target.value);
if (passwordError) setPasswordError(null);
}}
placeholder={t("passwordPlaceholder")}
aria-invalid={passwordError ? true : undefined}
className={`${inputClasses} pr-11`}
/>
<button
type="button"
onClick={() => setShowPassword((shown) => !shown)}
aria-label={showPassword ? t("hidePassword") : t("showPassword")}
aria-pressed={showPassword}
aria-controls="login-password"
title={showPassword ? t("hidePassword") : t("showPassword")}
className="absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-e-lg text-stone-500 transition-colors hover:text-stone-800 focus-visible:ring-2 focus-visible:ring-teal-700"
>
{showPassword ? (
<EyeOff className="h-5 w-5" aria-hidden="true" />
) : (
<Eye className="h-5 w-5" aria-hidden="true" />
)}
</button>
</div>
{passwordError ? (
<p className="mt-1.5 text-sm text-red-700">{passwordError}</p>
) : mode === "register" ? (