Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const render = ({ value, onChange, onSave, refValueInput }) => {
const hasOpenIdError = validateIri(value, ['openid']).length !== 0;
return (
<div>
<input placeholder="OpenID URL" value="{value}">
Must be a valid URL.
</div>
);
};
export default (identifierType, identifierValue) => {
switch (identifierType) {
case 'account': {
const homePage = identifierValue.get('homePage');
const name = identifierValue.get('name');
const hasHomePageErrors = validateIri(homePage, ['homePage']).length !== 0;
const hasNameErrors = name.length === 0;
return hasHomePageErrors || hasNameErrors;
}
case 'mbox': {
return validateMailto(identifierValue, ['mbox']).length !== 0;
}
case 'mbox_sha1sum': {
return identifierValue.length === 0;
}
case 'openid': {
return validateIri(identifierValue, ['openid']).length !== 0;
}
default: {
return true;
}
}
export const validateIfi = (ifi, path) => {
const valuePath = [...path, 'value'];
if (ifi.key === 'mbox') {
return validateMailto(ifi.value, valuePath);
}
if (ifi.key === 'mbox_sha1sum') {
return validateSha1(ifi.value, valuePath);
}
if (ifi.key === 'openid') {
return validateIri(ifi.value, valuePath);
}
if (ifi.key === 'account') {
return restrictToSchema({
homePage: required(validateIri),
name: required(checkType(String))
})(ifi.value, valuePath);
}
return ['invalid key'];
};
const render = ({ value, onChange, onSave, refHomePageInput, refNameInput }) => {
const homePage = value.get('homePage');
const name = value.get('name');
const hasHomePageError = validateIri(homePage, ['homepage']).length !== 0;
const hasNameError = name.length === 0;
const handleHomePageChange = (newHomePage) => {
onChange(value.set('homePage', newHomePage));
};
const handleNameChange = (newName) => {
onChange(value.set('name', newName));
};
return (
<div>
<div>
<input placeholder="Website" value="{homePage}"></div></div>
switch (identifierType) {
case 'account': {
const homePage = identifierValue.get('homePage');
const name = identifierValue.get('name');
const hasHomePageErrors = validateIri(homePage, ['homePage']).length !== 0;
const hasNameErrors = name.length === 0;
return hasHomePageErrors || hasNameErrors;
}
case 'mbox': {
return validateMailto(identifierValue, ['mbox']).length !== 0;
}
case 'mbox_sha1sum': {
return identifierValue.length === 0;
}
case 'openid': {
return validateIri(identifierValue, ['openid']).length !== 0;
}
default: {
return true;
}
}
};
const render = ({ value, onChange, onSave, refValueInput }) => {
const hasMboxError = validateMailto(value, ['mbox']).length !== 0;
const handleChange = (newValue) => {
onChange(`mailto:${newValue}`);
};
return (
<div>
<input placeholder="Email address" value="{value.replace('mailto:',">
<span>Must be a valid email address.</span>
</div>
);
export default (identifierType, identifierValue) => {
switch (identifierType) {
case 'account': {
const homePage = identifierValue.get('homePage');
const name = identifierValue.get('name');
const hasHomePageErrors = validateIri(homePage, ['homePage']).length !== 0;
const hasNameErrors = name.length === 0;
return hasHomePageErrors || hasNameErrors;
}
case 'mbox': {
return validateMailto(identifierValue, ['mbox']).length !== 0;
}
case 'mbox_sha1sum': {
return identifierValue.length === 0;
}
case 'openid': {
return validateIri(identifierValue, ['openid']).length !== 0;
}
default: {
return true;
}
}
};
export const validateIfi = (ifi, path) => {
const valuePath = [...path, 'value'];
if (ifi.key === 'mbox') {
return validateMailto(ifi.value, valuePath);
}
if (ifi.key === 'mbox_sha1sum') {
return validateSha1(ifi.value, valuePath);
}
if (ifi.key === 'openid') {
return validateIri(ifi.value, valuePath);
}
if (ifi.key === 'account') {
return restrictToSchema({
homePage: required(validateIri),
name: required(checkType(String))
})(ifi.value, valuePath);
}
return ['invalid key'];
};
const render = ({ value, onChange, onSave, refValueInput }) => {
const hasSha1Error = validateSha1(value, ['mbox_sha1sum']).length !== 0;
return (
<div>
<input placeholder="Sha1 encrypted email address" value="{value}">
Must be valid Sha1 text.
</div>
);
};
export const validateIfi = (ifi, path) => {
const valuePath = [...path, 'value'];
if (ifi.key === 'mbox') {
return validateMailto(ifi.value, valuePath);
}
if (ifi.key === 'mbox_sha1sum') {
return validateSha1(ifi.value, valuePath);
}
if (ifi.key === 'openid') {
return validateIri(ifi.value, valuePath);
}
if (ifi.key === 'account') {
return restrictToSchema({
homePage: required(validateIri),
name: required(checkType(String))
})(ifi.value, valuePath);
}
return ['invalid key'];
};