Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

character limit restriction & email validation added #5641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
7 changes: 6 additions & 1 deletion packages/ui/src/components/EditBox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
export let required: boolean = false
export let uppercase: boolean = false
export let propagateClick: boolean = false
export let maxlength: string | undefined = undefined


const dispatch = createEventDispatcher()

Expand Down Expand Up @@ -138,6 +140,7 @@
{#if format === 'password'}
<input
{disabled}
{maxlength}
style:width={maxWidth}
id="userPassword"
bind:this={input}
Expand All @@ -154,7 +157,8 @@
/>
{:else if format === 'number'}
<input
{disabled}
{disabled}
{maxlength}
style:width={maxWidth}
bind:this={input}
type="number"
Expand All @@ -172,6 +176,7 @@
{:else}
<input
{disabled}
{maxlength}
style:width={maxWidth}
bind:this={input}
type="text"
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/components/StylishEdit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
export let id: string | undefined = undefined
export let name: string | undefined = undefined
export let disabled: boolean = false
export let maxlength: string | undefined = undefined

</script>

<div class="editbox{error ? ' error' : ''}" style={width ? 'width: ' + width : ''}>
Expand All @@ -50,6 +52,7 @@
class:nolabel={!label}
{id}
{name}
{maxlength}
bind:value
on:blur
on:change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@
kind={'large-style'}
autoFocus
focusIndex={1}
maxlength="50"
/>
<EditBox
placeholder={contact.string.PersonLastNamePlaceholder}
bind:value={lastName}
kind={'large-style'}
focusIndex={2}
maxlength="50"
/>
<div class="mt-1">
<EditBox
Expand All @@ -173,6 +175,7 @@
kind={'small-style'}
focusIndex={3}
on:blur={changeEmail}
maxlength="50"
/>
</div>
<slot name="extraControls" />
Expand Down
3 changes: 3 additions & 0 deletions plugins/contact-resources/src/components/CreateGuest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@
kind={'large-style'}
autoFocus
focusIndex={1}
maxlength="50"
/>
<EditBox
placeholder={contact.string.PersonLastNamePlaceholder}
bind:value={lastName}
kind={'large-style'}
focusIndex={2}
maxlength="50"
/>
<div class="mt-1">
<EditBox
Expand All @@ -163,6 +165,7 @@
kind={'small-style'}
focusIndex={3}
on:blur={changeEmail}
maxlength="50"
/>
</div>
<slot name="extraControls" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
kind={'large-style'}
autoFocus
focusIndex={1}
maxlength="50"
/>
</div>

Expand Down
3 changes: 3 additions & 0 deletions plugins/contact-resources/src/components/CreatePerson.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,22 @@
kind={'large-style'}
autoFocus
focusIndex={1}
maxlength="50"
/>
<EditBox
placeholder={contact.string.PersonLastNamePlaceholder}
bind:value={lastName}
kind={'large-style'}
focusIndex={2}
maxlength="50"
/>
<div class="mt-1">
<EditBox
placeholder={contact.string.PersonLocationPlaceholder}
bind:value={object.city}
kind={'small-style'}
focusIndex={3}
maxlength="50"
/>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions plugins/contact-resources/src/components/EditEmployee.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
disabled={!editable}
on:change={firstNameChange}
focusIndex={1}
maxlength="50"
/>
{:else}
{firstName}
Expand All @@ -142,6 +143,7 @@
on:change={lastNameChange}
disabled={!editable}
focusIndex={2}
maxlength="50"
/>
{:else}
{lastName}
Expand Down
2 changes: 2 additions & 0 deletions plugins/contact-resources/src/components/EditPerson.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
bind:value={firstName}
on:change={firstNameChange}
focusIndex={1}
maxlength="50"
/>
</div>
<div class="name">
Expand All @@ -111,6 +112,7 @@
bind:value={lastName}
on:change={lastNameChange}
focusIndex={2}
maxlength="50"
/>
</div>
<div class="location">
Expand Down
4 changes: 4 additions & 0 deletions plugins/lead-resources/src/components/CreateCustomer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,22 @@
kind={'large-style'}
autoFocus
focusIndex={1}
maxlength="50"
/>
<EditBox
placeholder={contact.string.PersonLastNamePlaceholder}
bind:value={lastName}
kind={'large-style'}
focusIndex={2}
maxlength="50"
/>
<div class="mt-1">
<EditBox
placeholder={contact.string.PersonLocationPlaceholder}
bind:value={object.city}
kind={'small-style'}
focusIndex={3}
maxlength="50"
/>
</div>
<EditBox
Expand Down Expand Up @@ -207,6 +210,7 @@
kind={'large-style'}
autoFocus
focusIndex={1}
maxlength="50"
/>
</div>
{/if}
Expand Down
3 changes: 2 additions & 1 deletion plugins/login-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ConfirmationSent": "A message has been sent to your email containing a link to confirm your address.",
"ConfirmationSent2": "Please follow the link to complete your sign up.",
"Slogan": "A unique place to manage all of your work\nWelcome to the Platform",
"ContinueWith": "Continue with {provider}"
"ContinueWith": "Continue with {provider}",
"InvalidEmail": "Invalid Email"
}
}
5 changes: 3 additions & 2 deletions plugins/login-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ConfirmationSent": "Se ha enviado un mensaje a su correo electrónico con un enlace para confirmar su dirección.",
"ConfirmationSent2": "Por favor, siga el enlace para completar su registro.",
"Slogan": "Un lugar único para gestionar todo tu trabajo\nBienvenido/a a la Plataforma",
"ContinueWith": "Continuar com {provider}"
"ContinueWith": "Continuar com {provider}",
"InvalidEmail": "Email inválido"
}
}
}
5 changes: 3 additions & 2 deletions plugins/login-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ConfirmationSent": "Foi enviada uma mensagem para o seu email contendo um link para confirmar o seu endereço.",
"ConfirmationSent2": "Por favor, siga o link para concluir o seu registo.",
"Slogan": "Um local único para gerir todo o seu trabalho\nBem-vindo à Plataforma",
"ContinueWith": "Continuar com {provider}"
"ContinueWith": "Continuar com {provider}",
"InvalidEmail": "E-mail inválido"
}
}
}
3 changes: 2 additions & 1 deletion plugins/login-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ConfirmationSent": "На Вашу почту отправлено сообщение, c ссылкой для подтверждения email.",
"ConfirmationSent2": "Пожалуйста, перейдите по ссылке для завершения регистрации.",
"Slogan": "Уникальное место для организации всей вашей работы\nДобро пожаловать в Платформу",
"ContinueWith": "Войти через {provider}"
"ContinueWith": "Войти через {provider}",
"InvalidEmail": "Неверный адрес электронной почты"
}
}
1 change: 1 addition & 0 deletions plugins/login-resources/src/components/Form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
label={field.i18n}
name={field.id}
password={field.password}
maxlength={field.maxlength}
bind:value={object[field.name]}
on:input={() => validate($themeStore.language)}
on:blur={() => {
Expand Down
4 changes: 2 additions & 2 deletions plugins/login-resources/src/components/LoginForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
export let navigateUrl: string | undefined = undefined

const fields = [
{ id: 'email', name: 'username', i18n: login.string.Email },
{ id: 'email', name: 'username', i18n: login.string.Email, maxlength: "50", rules: [{rule: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, ruleDescr: login.string.InvalidEmail, notMatch: false}] },
{
id: 'current-password',
name: 'password',
i18n: login.string.Password,
password: true
password: true, maxlength: "50"
}
]

Expand Down
10 changes: 5 additions & 5 deletions plugins/login-resources/src/components/SignupForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import Form from './Form.svelte'

const fields = [
{ id: 'given-name', name: 'first', i18n: login.string.FirstName, short: true },
{ id: 'family-name', name: 'last', i18n: login.string.LastName, short: true },
{ id: 'email', name: 'username', i18n: login.string.Email },
{ id: 'new-password', name: 'password', i18n: login.string.Password, password: true },
{ id: 'new-password', name: 'password2', i18n: login.string.PasswordRepeat, password: true }
{ id: 'given-name', name: 'first', i18n: login.string.FirstName, short: true, maxlength: "50" },
{ id: 'family-name', name: 'last', i18n: login.string.LastName, short: true, maxlength: "50" },
{ id: 'email', name: 'username', i18n: login.string.Email, maxlength: "50", rules: [{rule: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, ruleDescr: login.string.InvalidEmail, notMatch: false }]},
{ id: 'new-password', name: 'password', i18n: login.string.Password, password: true, maxlength: "50" },
{ id: 'new-password', name: 'password2', i18n: login.string.PasswordRepeat, password: true, maxlength: "50" }
]

const object = {
Expand Down
5 changes: 3 additions & 2 deletions plugins/login-resources/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import login, { loginId } from '@hcengineering/login'
export default mergeIds(loginId, login, {
status: {
RequiredField: '' as StatusCode<{ field: string }>,
FieldsDoNotMatch: '' as StatusCode<{ field: string, field2: string }>,
FieldsDoNotMatch: '' as StatusCode<{ field: string; field2: string }>,
ConnectingToServer: '' as StatusCode,
IncorrectValue: '' as StatusCode<{ field: string }>
},
Expand Down Expand Up @@ -59,6 +59,7 @@ export default mergeIds(loginId, login, {
ConfirmationSent: '' as IntlString,
ConfirmationSent2: '' as IntlString,
Slogan: '' as IntlString,
ContinueWith: '' as IntlString
ContinueWith: '' as IntlString,
InvalidEmail: '' as IntlString
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@
autoFocus
maxWidth={'30rem'}
focusIndex={1}
maxlength="50"
/>
<EditBox
disabled={loading}
Expand All @@ -594,6 +595,7 @@
maxWidth={'30rem'}
kind={'large-style'}
focusIndex={2}
maxlength="50"
/>
<div class="mt-1">
<EditBox
Expand All @@ -612,6 +614,7 @@
kind={'small-style'}
focusIndex={4}
maxWidth={'30rem'}
maxlength="50"
/>
</div>
<div class="ml-4">
Expand Down
2 changes: 2 additions & 0 deletions plugins/setting-resources/src/components/Profile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@
autoFocus
focusIndex={1}
on:change={nameChange}
maxlength="50"
/>
<EditBox
placeholder={contact.string.PersonLastNamePlaceholder}
bind:value={lastName}
kind={'large-style'}
focusIndex={2}
on:change={nameChange}
maxlength="50"
/>
<div class="location">
<AttributeEditor
Expand Down