Cleanup
This commit is contained in:
@ -132,7 +132,6 @@ class AuthStore {
|
||||
this.user = data.user;
|
||||
this.team = data.team;
|
||||
this.token = Cookie.get('accessToken');
|
||||
console.log('token', this.token);
|
||||
|
||||
if (this.token) setImmediate(() => this.fetch());
|
||||
|
||||
|
@ -32,8 +32,6 @@ router.get('/redirect', auth(), async ctx => {
|
||||
});
|
||||
|
||||
const team = await Team.findById(user.teamId);
|
||||
|
||||
console.log(`redirecting: ${team.url}/dashboard`);
|
||||
ctx.redirect(`${team.url}/dashboard`);
|
||||
});
|
||||
|
||||
|
@ -117,7 +117,7 @@ export default function auth(options?: { required?: boolean } = {}) {
|
||||
...existing,
|
||||
[team.subdomain]: {
|
||||
name: team.name,
|
||||
logo: team.logo,
|
||||
logoUrl: team.logoUrl,
|
||||
url: team.url,
|
||||
expires,
|
||||
},
|
||||
@ -133,14 +133,13 @@ export default function auth(options?: { required?: boolean } = {}) {
|
||||
expires: addMinutes(new Date(), 1),
|
||||
domain,
|
||||
});
|
||||
console.log(`redirecting: ${team.url}/auth/redirect`);
|
||||
ctx.redirect(`${team.url}/auth/redirect`);
|
||||
} else {
|
||||
ctx.cookies.set('accessToken', user.getJwtToken(), {
|
||||
httpOnly: false,
|
||||
expires,
|
||||
});
|
||||
ctx.redirect(team.url);
|
||||
ctx.redirect(`${team.url}/dashboard`);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -45,13 +45,15 @@ const Team = sequelize.define(
|
||||
{
|
||||
getterMethods: {
|
||||
url() {
|
||||
if (!this.subdomain) return process.env.URL;
|
||||
if (!this.subdomain || !process.env.SUBDOMAINS_ENABLED) {
|
||||
return process.env.URL;
|
||||
}
|
||||
|
||||
const url = new URL(process.env.URL);
|
||||
url.host = `${this.subdomain}.${url.host}`;
|
||||
return url.href.replace(/\/$/, '');
|
||||
},
|
||||
logo() {
|
||||
logoUrl() {
|
||||
return (
|
||||
this.avatarUrl || (this.slackData ? this.slackData.image_88 : null)
|
||||
);
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
type Sessions = {
|
||||
[subdomain: string]: {
|
||||
name: string,
|
||||
logo: string,
|
||||
logoUrl: string,
|
||||
expires: string,
|
||||
url: string,
|
||||
},
|
||||
@ -54,7 +54,7 @@ function TopNavigation({ sessions }: { sessions: ?Sessions }) {
|
||||
{orderedSessions.map(session => (
|
||||
<MenuItem key={session.url}>
|
||||
<a href={`${session.url}/dashboard`}>
|
||||
<TeamLogo src={session.logo} width={20} height={20} />
|
||||
<TeamLogo src={session.logoUrl} width={20} height={20} />
|
||||
{session.name}
|
||||
</a>
|
||||
</MenuItem>
|
||||
|
@ -7,7 +7,7 @@ function present(ctx: Object, team: Team) {
|
||||
return {
|
||||
id: team.id,
|
||||
name: team.name,
|
||||
avatarUrl: team.logo,
|
||||
avatarUrl: team.logoUrl,
|
||||
slackConnected: !!team.slackId,
|
||||
googleConnected: !!team.googleId,
|
||||
sharing: team.sharing,
|
||||
|
@ -70,7 +70,6 @@ router.get('/', async ctx => {
|
||||
const subdomain = domain ? domain.subdomain : undefined;
|
||||
const accessToken = ctx.cookies.get('accessToken');
|
||||
|
||||
console.log('accessToken', accessToken);
|
||||
ctx.set('Cache-Control', 'no-cache');
|
||||
|
||||
if (accessToken) {
|
||||
|
Reference in New Issue
Block a user