Skip to content

Commit

Permalink
[#128886921] Make email field on autofire form as optional. nossas#248
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielrtakeda committed Nov 17, 2016
1 parent 0538a0f commit 2b91273
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/scripts/Widget/settings/AutoFireFormPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const AutoFireFormPage = (props) => {
/>
</FormGroup>
<FormGroup controlId="senderEmail" {...senderEmail}>
<ControlLabel>E-mail remetente</ControlLabel>
<ControlLabel>E-mail do remetente</ControlLabel>
<FormControl
type="text"
placeholder="Defina o e-mail que irá aparecer na mensagem enviada."
Expand Down Expand Up @@ -106,11 +106,8 @@ const fields = ['sender_name', 'sender_email', 'email_subject', 'email_text']

const validate = values => {
const errors = {}
if (values.id && !/(UA|YT|MO)-\d+-\d+/i.test(values.id)) {
errors.id = 'Informe uma ID válida'
}
if (!validator.isValidEmail(values.sender_email)) {
errors.sender_email = 'Informe um e-mail inválido'
if (values.sender_email && !validator.isValidEmail(values.sender_email)) {
errors.sender_email = 'Informe um e-mail válido'
}
return errors
}
Expand Down

0 comments on commit 2b91273

Please sign in to comment.