Fixes: Teams with non-latin characters annot signin

This commit is contained in:
Tom Moor
2018-12-12 10:31:08 -08:00
parent 05fe573974
commit 836f9a88a2
3 changed files with 19 additions and 15 deletions

View File

@ -146,7 +146,7 @@ export default class AuthStore {
const sessions = Cookie.getJSON('sessions') || {};
delete sessions[team.id];
Cookie.set('sessions', sessions, {
Cookie.set('sessions', JSON.stringify(sessions), {
domain: stripSubdomain(window.location.hostname),
});
this.team = null;

View File

@ -116,9 +116,9 @@ export default function auth(options?: { required?: boolean } = {}) {
const sessions = JSON.stringify({
...existing,
[team.id]: {
name: team.name,
name: encodeURIComponent(team.name),
logoUrl: team.logoUrl,
url: team.url,
url: encodeURIComponent(team.url),
},
});
ctx.cookies.set('sessions', sessions, {

View File

@ -59,18 +59,22 @@ function TopNavigation({ sessions, loggedIn }: Props) {
<MenuItem highlighted>
<a>Your Teams</a>
<ol>
{orderedSessions.map(session => (
<MenuItem key={session.url}>
<a href={`${session.url}/dashboard`}>
<TeamLogo
src={session.logoUrl}
width={20}
height={20}
/>
{session.name}
</a>
</MenuItem>
))}
{orderedSessions.map(session => {
const url = decodeURIComponent(session.url);
return (
<MenuItem key={url}>
<a href={`${url}/dashboard`}>
<TeamLogo
src={session.logoUrl}
width={20}
height={20}
/>
{decodeURIComponent(session.name)}
</a>
</MenuItem>
);
})}
</ol>
</MenuItem>
) : (