Skip to content

Commit

Permalink
Ray fix dev redirect (#876)
Browse files Browse the repository at this point in the history
* feat(client): dialog for when user logs out

* added auth cleanup and user addition to db

* lint

* changed ci

* Update auth.service.ts

* Feature: Changed dark mode settings toggle to icon button in sidebar (Sidebar Dark Mode Icon #850) (#850)

* adding redirect link to devsoc

* made dark mode button component

* removed dark mode toggle

* removed darkmode toggle from settings

* made sidebar footer icons padding consistent

* added prop type for dark mode button

* sync dark mode button updates

* fully implemented dark mode button

---------

Co-authored-by: ray <raiyan.ahmed@gmail.com>
Co-authored-by: Dylan Zhang <dylan.zhang15@gmail.com>

* docs: added our latest 2024 subcom member

* renamed migrations

* testing out db migration changes

* changing script

* changing host name redirect handler

* fixed redirect details

* docker file fixed

* cleaned conditional

* removing migrations folder

---------

Co-authored-by: hhuolu <chhuolucy@gmail.com>
Co-authored-by: dlyn <100419289+dlynz@users.noreply.github.com>
Co-authored-by: Dylan Zhang <dylan.zhang15@gmail.com>
Co-authored-by: Shaam <shaamjevan.sj@gmail.com>
Co-authored-by: Jasmine Tran <z5394841@ad.unsw.edu.au>
  • Loading branch information
6 people committed Aug 16, 2024
1 parent 17d5d61 commit 03fc031
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/src/components/sidebar/UserAccount.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccountCircle, LoginRounded, LogoutRounded } from '@mui/icons-material';
import { Button, IconButton, Tooltip } from '@mui/material';
import { Button, Dialog, IconButton, Tooltip } from '@mui/material';
import { styled } from '@mui/system';
import React, { useEffect, useState } from 'react';

Expand Down
16 changes: 16 additions & 0 deletions server/migrate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

cd /app/prisma

# Check if there are any migrations
if [ -z "$(ls -A migrations)" ]; then
echo "No existing migrations found. Creating initial migration..."
else
echo "Existing migrations found. Deleting and reapplying..."
rm -rf migrations/*
fi

npx prisma migrate dev --name init
npx prisma generate
2 changes: 1 addition & 1 deletion server/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class AppService {
const port = this.configService.get<number>('PORT');
const auto = `${this.configService.get<string>('AUTO_SERVER_HOST_NAME')}:${this.configService.get<string>('AUTO_SERVER_HOST_PORT')}`;
const client = `${this.configService.get<string>('CLIENT_HOST_NAME')}:${this.configService.get<string>('CLIENT_HOST_PORT')}`;
const redirectLink = `${this.configService.get<string>('CLIENT_HOST_NAME')}:${this.configService.get<string>('CLIENT_HOST_PORT')}`;
const redirectLink = `https://${this.configService.get<string>('CLIENT_HOST_NAME')}:${this.configService.get<string>('CLIENT_HOST_PORT')}`;

return {
env,
Expand Down
13 changes: 12 additions & 1 deletion server/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ export class AuthController {
@UseGuards(LoginGuard)
@Get('/callback/csesoc')
loginCallback(@Res() res: Response) {
res.redirect(this.configService.get<string>('app.redirectLink'));
console.log(
this.configService.get<string>(
'app.redirectLink',
'https://notangles.devsoc.app/api/auth/callback/csesoc',
),
);
res.redirect(
this.configService.get<string>(
'app.redirectLink',
'https://notangles.devsoc.app/api/auth/callback/csesoc',
),
);
}

@Get('/logout')
Expand Down
6 changes: 5 additions & 1 deletion server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ export default registerAs('app', () => ({
port: parseInt(process.env.PORT, 10) || 3000,
auto: `${process.env.AUTO_SERVER_HOST_NAME}:${process.env.AUTO_SERVER_HOST_PORT}`,
client: `${process.env.CLIENT_HOST_NAME}:${process.env.CLIENT_HOST_PORT}`,
redirectLink: `${process.env.CLIENT_HOST_NAME}:${process.env.CLIENT_HOST_PORT}`,
redirectLink:
process.env.NODE_ENV === 'dev'
? `http://`
: `https://` +
`${process.env.CLIENT_HOST_NAME}:${process.env.CLIENT_HOST_PORT}`,
}));

0 comments on commit 03fc031

Please sign in to comment.