mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-16 08:27:55 +00:00
Manual refinement
This commit is contained in:
@@ -30,7 +30,8 @@
|
|||||||
"login_link_signup": "Sign up",
|
"login_link_signup": "Sign up",
|
||||||
"login_link_forgot_password": "Forgot password",
|
"login_link_forgot_password": "Forgot password",
|
||||||
"reset_password_request_title": "Reset password",
|
"reset_password_request_title": "Reset password",
|
||||||
"reset_password_request_description": "Enter your username or email address. If an account exists, a link to reset your password will be emailed. This only works if you already added a primary email address and verified it.",
|
"reset_password_request_description": "Enter your username or email address. If an account exists, a link to reset your password will be emailed.",
|
||||||
|
"reset_password_request_primary_required": "This only works if you already added a primary email address and verified it.",
|
||||||
"reset_password_request_identifier_label": "Username or email",
|
"reset_password_request_identifier_label": "Username or email",
|
||||||
"reset_password_request_button_submit": "Send reset link",
|
"reset_password_request_button_submit": "Send reset link",
|
||||||
"reset_password_sent_title": "Check your inbox",
|
"reset_password_sent_title": "Check your inbox",
|
||||||
@@ -41,7 +42,6 @@
|
|||||||
"reset_password_form_password": "New password",
|
"reset_password_form_password": "New password",
|
||||||
"reset_password_form_confirm": "Confirm new password",
|
"reset_password_form_confirm": "Confirm new password",
|
||||||
"reset_password_form_button_submit": "Set password",
|
"reset_password_form_button_submit": "Set password",
|
||||||
"reset_password_form_passwords_no_match": "Passwords do not match",
|
|
||||||
"reset_password_form_error_invalid": "This reset link is invalid or has expired. Please request a new one.",
|
"reset_password_form_error_invalid": "This reset link is invalid or has expired. Please request a new one.",
|
||||||
"reset_password_success_title": "Password changed",
|
"reset_password_success_title": "Password changed",
|
||||||
"reset_password_success_description": "Your password has been changed. You can now sign in with your new password.",
|
"reset_password_success_description": "Your password has been changed. You can now sign in with your new password.",
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import accountApi from "../app/AccountApi";
|
|||||||
import AvatarBox from "./AvatarBox";
|
import AvatarBox from "./AvatarBox";
|
||||||
import routes from "./routes";
|
import routes from "./routes";
|
||||||
|
|
||||||
|
// Verification states for the email-verify landing page
|
||||||
|
const STATUS_VERIFYING = "verifying";
|
||||||
|
const STATUS_SUCCESS = "success";
|
||||||
|
const STATUS_ERROR = "error";
|
||||||
|
|
||||||
// EmailVerify is the magic-link landing page for email verification. It performs the verification
|
// EmailVerify is the magic-link landing page for email verification. It performs the verification
|
||||||
// via a POST (the GET that loads this page has no side effects, so link prefetchers / scanners
|
// via a POST (the GET that loads this page has no side effects, so link prefetchers / scanners
|
||||||
// cannot consume the single-use token). The raw token is stripped from the URL on load to keep
|
// cannot consume the single-use token). The raw token is stripped from the URL on load to keep
|
||||||
@@ -17,7 +22,7 @@ const EmailVerify = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { token } = useParams();
|
const { token } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [status, setStatus] = useState("verifying"); // "verifying" | "success" | "error"
|
const [status, setStatus] = useState(STATUS_VERIFYING);
|
||||||
const ran = useRef(false);
|
const ran = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -30,23 +35,23 @@ const EmailVerify = () => {
|
|||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await accountApi.verifyEmailToken(token);
|
await accountApi.verifyEmailToken(token);
|
||||||
setStatus("success");
|
setStatus(STATUS_SUCCESS);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`[EmailVerify] Verification failed`, e);
|
console.log(`[EmailVerify] Verification failed`, e);
|
||||||
setStatus("error");
|
setStatus(STATUS_ERROR);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AvatarBox>
|
<AvatarBox>
|
||||||
{status === "verifying" && (
|
{status === STATUS_VERIFYING && (
|
||||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||||
<CircularProgress size={24} />
|
<CircularProgress size={24} />
|
||||||
<Typography sx={{ typography: "h6" }}>{t("email_verify_progress_title")}</Typography>
|
<Typography sx={{ typography: "h6" }}>{t("email_verify_progress_title")}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{status === "success" && (
|
{status === STATUS_SUCCESS && (
|
||||||
<>
|
<>
|
||||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||||
<CheckCircleOutlineIcon color="success" sx={{ fontSize: 28 }} />
|
<CheckCircleOutlineIcon color="success" sx={{ fontSize: 28 }} />
|
||||||
@@ -58,7 +63,7 @@ const EmailVerify = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{status === "error" && (
|
{status === STATUS_ERROR && (
|
||||||
<>
|
<>
|
||||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||||
<ErrorOutlineIcon color="error" sx={{ fontSize: 28 }} />
|
<ErrorOutlineIcon color="error" sx={{ fontSize: 28 }} />
|
||||||
|
|||||||
@@ -30,10 +30,6 @@ const PasswordReset = () => {
|
|||||||
|
|
||||||
const handleSubmit = async (event) => {
|
const handleSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (password !== confirm) {
|
|
||||||
setError(t("reset_password_form_passwords_no_match"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
setSending(true);
|
setSending(true);
|
||||||
setError("");
|
setError("");
|
||||||
@@ -91,7 +87,13 @@ const PasswordReset = () => {
|
|||||||
onChange={(ev) => setConfirm(ev.target.value.trim())}
|
onChange={(ev) => setConfirm(ev.target.value.trim())}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
/>
|
/>
|
||||||
<Button type="submit" fullWidth variant="contained" disabled={sending || password === "" || confirm === ""} sx={{ mt: 2, mb: 2 }}>
|
<Button
|
||||||
|
type="submit"
|
||||||
|
fullWidth
|
||||||
|
variant="contained"
|
||||||
|
disabled={sending || password === "" || confirm === "" || password !== confirm}
|
||||||
|
sx={{ mt: 2, mb: 2 }}
|
||||||
|
>
|
||||||
{t("reset_password_form_button_submit")}
|
{t("reset_password_form_button_submit")}
|
||||||
</Button>
|
</Button>
|
||||||
{error && (
|
{error && (
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ const PasswordResetRequest = () => {
|
|||||||
<AvatarBox>
|
<AvatarBox>
|
||||||
<Typography sx={{ typography: "h6" }}>{t("reset_password_request_title")}</Typography>
|
<Typography sx={{ typography: "h6" }}>{t("reset_password_request_title")}</Typography>
|
||||||
<Box component="form" onSubmit={handleSubmit} noValidate sx={{ mt: 1 }}>
|
<Box component="form" onSubmit={handleSubmit} noValidate sx={{ mt: 1 }}>
|
||||||
<Typography sx={{ mt: 1, mb: 1.5 }}>{t("reset_password_request_description")}</Typography>
|
<Typography sx={{ mt: 1 }}>{t("reset_password_request_description")}</Typography>
|
||||||
|
<Typography sx={{ mt: 1, mb: 1.5, fontWeight: "bold" }}>{t("reset_password_request_primary_required")}</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
margin="dense"
|
margin="dense"
|
||||||
required
|
required
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import config from "../app/config";
|
|||||||
import { shortUrl } from "../app/utils";
|
import { shortUrl } from "../app/utils";
|
||||||
|
|
||||||
const routes = {
|
const routes = {
|
||||||
|
app: config.app_root,
|
||||||
login: "/login",
|
login: "/login",
|
||||||
signup: "/signup",
|
signup: "/signup",
|
||||||
app: config.app_root,
|
|
||||||
account: "/account",
|
account: "/account",
|
||||||
settings: "/settings",
|
settings: "/settings",
|
||||||
passwordResetRequest: "/reset-password",
|
passwordResetRequest: "/reset-password",
|
||||||
@@ -17,7 +17,7 @@ const routes = {
|
|||||||
return `/${shortUrl(subscription.baseUrl)}/${subscription.topic}`;
|
return `/${shortUrl(subscription.baseUrl)}/${subscription.topic}`;
|
||||||
}
|
}
|
||||||
return `/${subscription.topic}`;
|
return `/${subscription.topic}`;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default routes;
|
export default routes;
|
||||||
|
|||||||
Reference in New Issue
Block a user