Skip to content

Commit

Permalink
Merge pull request #482 from opencollective/fix/target-blank
Browse files Browse the repository at this point in the history
Add rel="noopener noreferrer" with target="_blank"
  • Loading branch information
znarf authored Jun 4, 2018
2 parents bde111c + b82809b commit db1b773
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/apps/expenses/components/ExpenseDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class ExpenseDetails extends React.Component {
/>
}
{ !editMode && expense.attachment &&
<a href={expense.attachment} target="_blank" title="Open receipt in a new window">
<a href={expense.attachment} target="_blank" rel="noopener noreferrer" title="Open receipt in a new window">
<img src={previewAttachmentImage} />
</a>
}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/expenses/components/TransactionDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class TransactionDetails extends React.Component {
{type === 'debit' &&
<div className="frame">
{transaction.attachment &&
<a href={transaction.attachment} target="_blank" title="Open receipt in a new window">
<a href={transaction.attachment} target="_blank" rel="noopener noreferrer" title="Open receipt in a new window">
<img src={imagePreview(transaction.attachment)} />
</a>
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CollectiveCover.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ ${description}`
<div className="contact">
{ collective.host && collective.isActive && <div className="host"><label><FormattedMessage id="collective.cover.hostedBy" defaultMessage="Hosted by" /></label><Link route={`/${collective.host.slug}`}>{collective.host.name} </Link></div> }
{ collective.host && !collective.isActive && <div className="host"><label><FormattedMessage id="collective.cover.pendingApprovalFrom" defaultMessage="Pending approval from" /></label><Link route={`/${collective.host.slug}`}>{collective.host.name} </Link></div> }
{ twitterHandle && <div className="twitterHandle"><a href={`https://twitter.com/${twitterHandle}`} target="_blank">@{twitterHandle}</a></div> }
{ website && <div className="website"><a href={website} target="_blank">{prettyUrl(website) }</a></div> }
{ twitterHandle && <div className="twitterHandle"><a href={`https://twitter.com/${twitterHandle}`} target="_blank" rel="noopener noreferrer">@{twitterHandle}</a></div> }
{ website && <div className="website"><a href={website} target="_blank" rel="noopener noreferrer">{prettyUrl(website) }</a></div> }
</div>
}
{ collective.type === 'EVENT' &&
Expand Down
4 changes: 2 additions & 2 deletions src/components/CreateCollectiveForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ class CreateCollectiveForm extends React.Component {
<label>{intl.formatMessage(this.messages['tos.label'])}</label>
<div>
<input type="checkbox" name="tos" onChange={(value) => this.handleChange("tos", value)} />
<span>I agree with the <a href="/tos" target="_blank">terms of service of Open Collective</a></span>
<span>I agree with the <a href="/tos" target="_blank" rel="noopener noreferrer">terms of service of Open Collective</a></span>
</div>
{ (get(host, 'settings.tos')) &&
<div>
<input type="checkbox" name="hostTos" onChange={(value) => this.handleChange("hostTos", value)} />
<span>I agree with the <a href={get(host, 'settings.tos')} target="_blank">terms of service of the host</a> (<a href={`/${host.slug}`} target="_blank">{host.name}</a>) that will collect money on behalf of our collective</span>
<span>I agree with the <a href={get(host, 'settings.tos')} target="_blank" rel="noopener noreferrer">terms of service of the host</a> (<a href={`/${host.slug}`} target="_blank">{host.name}</a>) that will collect money on behalf of our collective</span>
</div>
}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/EventsWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class EventsWithData extends React.Component {
<div className="title">
<h2><FormattedMessage id="events.title.futureEvents" values={{n: futureEvents.length}} defaultMessage={`Next {n, plural, one {event} other {events}}`} /></h2>
{ this.isIframe &&
<div className="action"><a href={`/${this.props.collectiveSlug}/events/new`} onClick={this.createEvent} target="_blank"><FormattedMessage id="events.widget.createEvent" defaultMessage={`Create an Event`} /></a></div>
<div className="action"><a href={`/${this.props.collectiveSlug}/events/new`} onClick={this.createEvent} target="_blank" rel="noopener noreferrer"><FormattedMessage id="events.widget.createEvent" defaultMessage={`Create an Event`} /></a></div>
}
</div>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExportImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ExportImages extends React.Component {
__html: image.code
}}
/>
<div className="url"><a href={image.url} target="_blank">{image.url}</a></div>
<div className="url"><a href={image.url} target="_blank" rel="noopener noreferrer">{image.url}</a></div>
<div className="code">{image.code}</div>
<div>
<label>Options:</label>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Location.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Location extends React.Component {
<div className="description">
{this.props.showTitle && <h1>Location</h1>}
<div className="name">{name}</div>
<div className="address" style={{color: colors.darkgray}}><a href={`http://maps.apple.com/?q=${lat},${long}`} target="_blank">{address}</a></div>
<div className="address" style={{color: colors.darkgray}}><a href={`http://maps.apple.com/?q=${lat},${long}`} target="_blank" rel="noopener noreferrer">{address}</a></div>
</div>
{ lat && long &&
<div className="map">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Map extends React.Component {
draggable={false}
/>
</Gmaps>
<a className="map-overlay" href={`http://maps.apple.com/?q=${lat},${long}`} target="_blank"></a>
<a className="map-overlay" href={`http://maps.apple.com/?q=${lat},${long}`} target="_blank" rel="noopener noreferrer"></a>
</div>
);
}
Expand Down
9 changes: 5 additions & 4 deletions src/pages/banner-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ class Banner extends React.Component {
.btn.hover {
background-position: 0 -100px;
}
`}</style>
`}
</style>

{ backers.organizations + backers.users === 0 &&
<a type="button" className="btn blue contribute" target="_blank" href={`https://opencollective.com/${collectiveSlug}`} />
<a type="button" className="btn blue contribute" target="_blank" rel="noopener noreferrer" href={`https://opencollective.com/${collectiveSlug}`} />
}


Expand All @@ -187,7 +188,7 @@ class Banner extends React.Component {
/>
</h2>
<div className="actions">
<a href={`https://opencollective.com/${collectiveSlug}`} target="_blank" style={style.a}><FormattedMessage id="widget.becomeSponsor" defaultMessage="Become a sponsor" /></a>
<a href={`https://opencollective.com/${collectiveSlug}`} target="_blank" rel="noopener noreferrer" style={style.a}><FormattedMessage id="widget.becomeSponsor" defaultMessage="Become a sponsor" /></a>
</div>
<MembersWithData
collective={collective}
Expand All @@ -210,7 +211,7 @@ class Banner extends React.Component {
</h2>

<div className="actions">
<a href={`https://opencollective.com/${collectiveSlug}`} target="_blank" style={style.a}><FormattedMessage id="widget.becomeBacker" defaultMessage="Become a backer" /></a>
<a href={`https://opencollective.com/${collectiveSlug}`} target="_blank" rel="noopener noreferrer" style={style.a}><FormattedMessage id="widget.becomeBacker" defaultMessage="Become a backer" /></a>
</div>
<MembersWithData
collective={collective}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ButtonPage extends React.Component {
background-position: 0 -100px;
}
`}</style>
<a type="button" className={`btn ${color} ${verb}`} target="_blank" href={`https://opencollective.com/${collectiveSlug}/${verb}`} />
<a type="button" className={`btn ${color} ${verb}`} target="_blank" rel="noopener noreferrer" href={`https://opencollective.com/${collectiveSlug}/${verb}`} />
</div>
);
}
Expand Down

0 comments on commit db1b773

Please sign in to comment.