Skip to content

Commit

Permalink
Do not allow for <> in email
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 29, 2024
1 parent 7f08462 commit 74467f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion account-gui/src/routes/Login.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
const init = el => el.focus();
const handleInput = e => {
const email = (e.target.value || "").replace(/[<>]/g, "");
e.target.value = email;
$user.email = email;
}
const allowedNext = email => validEmail(email) || $user.knownUser;
const nextStep = () => {
Expand Down Expand Up @@ -144,7 +150,8 @@
class={`${emailNotFound ? 'error' : ''}`}
placeholder={I18n.t("login.emailPlaceholder")}
use:init
bind:value={$user.email}
on:input={handleInput}
value={$user.email}
on:keydown={handleEmailEnter}
spellcheck="false">
{/if}
Expand Down
11 changes: 9 additions & 2 deletions account-gui/src/routes/Request.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
emailInUse = true;
} else if (e.status === 412) {
emailForbidden = true;
}else {
} else {
navigate("/expired", {replace: true});
}
});
Expand All @@ -63,6 +63,12 @@
const init = el => el.focus();
const handleInput = e => {
const email = (e.target.value || "").replace(/[<>]/g, "");
e.target.value = email;
$user.email = email;
}
const allowedNext = (email, familyName, givenName, agreedWithTerms) => {
return validEmail(email) && familyName && givenName && agreedWithTerms && !$domains.allowedDomainNamesError
};
Expand Down Expand Up @@ -186,7 +192,8 @@
class:error={emailInUse || emailForbidden}
placeholder={I18n.t("login.emailPlaceholder")}
use:init
bind:value={$user.email}
on:input={handleInput}
value={$user.email}
on:blur={handleEmailBlur}>
{#if !initial && !validEmail($user.email)}
<div class="error"><span class="svg">{@html critical}</span><span>{I18n.t("login.invalidEmail")}</span></div>
Expand Down

0 comments on commit 74467f8

Please sign in to comment.