Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1691,13 +1691,16 @@ fun SettingsScreen(

// Custom Addon Input Modal
if (showCustomAddonInput) {
val isValidAddonUrl = customAddonUrl.isNotBlank() &&
(customAddonUrl.trim().startsWith("http://", ignoreCase = true) || customAddonUrl.trim().startsWith("https://", ignoreCase = true))
InputModal(
title = stringResource(R.string.add_addon),
fields = listOf(
InputField(label = stringResource(R.string.settings_label_url), value = customAddonUrl, onValueChange = { customAddonUrl = it })
),
isConfirmEnabled = isValidAddonUrl,
onConfirm = {
if (customAddonUrl.isNotBlank()) {
if (isValidAddonUrl) {
viewModel.addCustomAddon(customAddonUrl.trim())
customAddonUrl = ""
showCustomAddonInput = false
Expand Down Expand Up @@ -8691,6 +8694,7 @@ private fun InputModal(
title: String,
supportingText: String? = null,
fields: List<InputField>,
isConfirmEnabled: Boolean = true,
onConfirm: () -> Unit,
onDismiss: () -> Unit
) {
Expand Down Expand Up @@ -8860,8 +8864,10 @@ private fun InputModal(
true
}
focusedIndex == fields.size + 2 -> {
hideKeyboardAll()
onConfirm()
if (isConfirmEnabled) {
hideKeyboardAll()
onConfirm()
}
true
}
else -> false
Expand Down Expand Up @@ -9163,25 +9169,26 @@ private fun InputModal(
.weight(1f)
.clip(RoundedCornerShape(10.dp))
.background(
color = if (isConfirmFocused) Color.White else Color.Black.copy(alpha = 0.82f),
color = if (isConfirmFocused && isConfirmEnabled) Color.White else Color.Black.copy(alpha = 0.82f),
shape = RoundedCornerShape(10.dp)
)
.border(
width = 1.dp,
color = if (isConfirmFocused) Color.White else Color.White.copy(alpha = 0.14f),
color = if (isConfirmFocused && isConfirmEnabled) Color.White else Color.White.copy(alpha = 0.14f),
shape = RoundedCornerShape(10.dp)
)
.clickable {
.clickable(enabled = isConfirmEnabled) {
hideKeyboardAll()
onConfirm()
}
.padding(vertical = 12.dp),
.padding(vertical = 12.dp)
.graphicsLayer { alpha = if (isConfirmEnabled) 1f else 0.45f },
contentAlignment = Alignment.Center
) {
Text(
text = tr("Confirm"),
style = ArflixTypography.button,
color = if (isConfirmFocused) Color.Black else Color.White
color = if (isConfirmFocused && isConfirmEnabled) Color.Black else Color.White
)
}
}
Expand Down
21 changes: 21 additions & 0 deletions netlify-auth-site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,23 @@ <h1 class="title">Account Access</h1>
throw new Error("This password link is no longer valid. Request a new reset email.");
}

function validateFormInputs() {
const emailVal = emailEl.value.trim();
const passVal = passEl.value;
if (!emailVal || !passVal) {
return "Email and password are required.";
}
const emailErr = validateEmail(emailVal, false);
if (emailErr) return emailErr;
return null;
}

signInBtn.onclick = async () => {
const validationError = validateFormInputs();
if (validationError) {
setStatus(validationError, "error");
return;
}
try {
setBusy(true);
setStatus("Signing in...");
Expand All @@ -886,6 +902,11 @@ <h1 class="title">Account Access</h1>
};

signUpBtn.onclick = async () => {
const validationError = validateFormInputs();
if (validationError) {
setStatus(validationError, "error");
return;
}
try {
setBusy(true);
const email = requireValidEmail(emailEl.value);
Expand Down
2 changes: 1 addition & 1 deletion web/components/settings/SettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ function AddonsSection() {
<button
type="button"
className="primary"
disabled={installing}
disabled={installing || !addonUrl.trim()}
onClick={() => void install()}
>
<Plus size={18} /> {installing ? "Installing..." : "Install"}
Expand Down