Skip to content

Commit

Permalink
fix(issues): unauthorised login error, create card with user, change …
Browse files Browse the repository at this point in the history
…responsible slack message (#582)

* fix(issues): unauthorised login error, create card with user, change responsible slack message

* fix(env-examples): add example values

* feat(split-retro): next day
  • Loading branch information
nunocaseiro authored Nov 16, 2022
1 parent 3d36ed5 commit ea5e810
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
23 changes: 12 additions & 11 deletions backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ NODE_ENV=dev
DB_USER=backend

# db password
DB_PASSWORD=password-for-db
DB_PASSWORD=dc2021backend

# db name
DB_NAME=dc

# docker database container name
DB_HOST=localhost
DB_HOST=127.0.0.1

# replica set
DB_REPLICA_SET=dcrs
Expand All @@ -30,27 +30,25 @@ SMTP_ENABLE=false
# -> Slack <- #
SLACK_ENABLE=false

SLACK_CHANNEL_PREFIX=
SLACK_CHANNEL_PREFIX=test

SLACK_API_BOT_TOKEN=
SLACK_API_BOT_TOKEN=test

SLACK_MASTER_CHANNEL_ID=
SLACK_MASTER_CHANNEL_ID=test

# -> Redis <- #
REDIS_USER=

REDIS_PASSWORD=
REDIS_PASSWORD=password123

REDIS_HOST=127.0.0.1

REDIS_PORT=6379

# -> Authentication <- #
# secret to sign access token in backend
JWT_ACCESS_TOKEN_SECRET=random-secret
JWT_ACCESS_TOKEN_SECRET=backenddc2021

# access token expiration time in seconds
JWT_ACCESS_TOKEN_EXPIRATION_TIME=900
JWT_ACCESS_TOKEN_EXPIRATION_TIME=3600

# secret to sign refresh token in backend
JWT_REFRESH_TOKEN_SECRET=refresh-random-secret
Expand All @@ -61,9 +59,12 @@ JWT_REFRESH_TOKEN_EXPIRATION_TIME=1
# auth url exposed to the browser
NEXT_PUBLIC_NEXTAUTH_URL=http://localhost:3000

#secret to encode jwt in frontend
SECRET=56e9169e3383d4a73fef9e0b4a3ff4e2

# -> Social Authentication <- #
# enable azure authentication module on the backend
AZURE_ENABLE=true
AZURE_ENABLE=false

# -> Azure Secrets <- #
# azure client ID
Expand Down
6 changes: 5 additions & 1 deletion backend/src/modules/boards/services/update.board.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ export default class UpdateBoardServiceImpl implements UpdateBoardServiceInterfa
.lean()
.exec();

if (updatedBoard && currentResponsible?.id !== newResponsible.id && board.slackChannelId) {
if (
updatedBoard &&
String(currentResponsible?.id) !== newResponsible.id &&
board.slackChannelId
) {
this.handleResponsibleSlackMessage(
newResponsible,
currentResponsible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export class CreateSchedulesService implements CreateSchedulesServiceInterface {
willRunAt: new Date(new Date().getFullYear(), month, day, 10).toISOString()
});
if (!cronJobDoc) throw Error('CronJob not created');
const job = new CronJob(`0 10 ${day} ${month} *`, () =>
const job = new CronJob(`0 10 17 10 *`, () =>
// const job = new CronJob(`0 10 ${day} ${month} *`, () =>
this.handleComplete(String(ownerId), teamId, cronJobDoc.board.toString())
);
this.schedulerRegistry.addCronJob(String(boardId), job);
Expand Down
4 changes: 2 additions & 2 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ NEXT_PUBLIC_BACKEND_URL=http://localhost:3200
BACKEND_URL=http://localhost:3200

# -> Authentication <-#
# secret to encode jwt in frontend
SECRET=<random-secret-key>
# secret to encode jwt in frontend -> openssl rand -base64 32
SECRET=EMnYyD4855S4mXKtB7Ks+Ua3nQSFtL4P8kydIQm1nSw=

# auth url
NEXTAUTH_URL=http://localhost:3000
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/auth/LoginForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
NEXT_PUBLIC_ENABLE_GOOGLE
} from 'utils/constants';
import { ToastStateEnum } from 'utils/enums/toast-types';
import { transformLoginErrorCodes } from 'utils/errorCodes';
import { DASHBOARD_ROUTE } from 'utils/routes';
import { LoginButton, OrSeparator, StyledForm, StyledHoverIconFlex } from './styles';

Expand Down Expand Up @@ -87,7 +86,8 @@ const LoginForm: React.FC<LoginFormProps> = ({ setShowTroubleLogin }) => {
router.push(DASHBOARD_ROUTE);
return;
}
setLoginErrorCode(transformLoginErrorCodes(result.error));

setLoginErrorCode(result.status);

setLoading((prevState) => ({ ...prevState, credentials: false }));
};
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/hooks/useCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ const useCards = () => {
text: newCardData.card.text,
votes: [],
comments: [],
anonymous: newCardData.card.anonymous
anonymous: newCardData.card.anonymous,
createdBy: {
_id: user ? user.id : '',
firstName: user ? user.firstName : '',
lastName: user ? user.lastName : '',
email: '',
joinedAt: '',
isSAdmin: false
}
}
]
};
Expand Down

0 comments on commit ea5e810

Please sign in to comment.