Skip to content

Commit

Permalink
Cleaned up more uses of setting user is logged manually, and switched…
Browse files Browse the repository at this point in the history
… to always calling auth
  • Loading branch information
sjkobori committed Jun 27, 2024
1 parent 06e7511 commit 5caaf3c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/home.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Home', function() {
it('Home page loads correctly', function() {
cy.visit(Cypress.env('baseUrl'));
cy.contains('DUOS');
cy.contains('Sign-in/Register');
cy.contains('Sign in');
cy.contains('What is DUOS and how does it work?');
cy.contains('DUOS for DACs');
cy.contains('Institutional Oversight');
Expand Down
2 changes: 1 addition & 1 deletion src/components/DuosHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const NavigationTabsComponent = (props) => {
<div
style={{ display: 'flex', alignItems: 'center', flexDirection: orientation === 'vertical' ? 'column' : 'row' }}
>
<SignInButton style={{ whiteSpace: 'nowrap', color: 'black' }}></SignInButton>
<SignInButton style={{ whiteSpace: 'nowrap', color: 'black' }} />
</div>
)}
{isLogged && (
Expand Down
2 changes: 1 addition & 1 deletion src/libs/signIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const checkToSAndRedirect = async (
const userStatus = await ToS.getStatus();
const { tosAccepted } = userStatus;
if (!isEmpty(userStatus) && !tosAccepted) {
Storage.setUserIsLogged(false);
Auth.signOut();
if (isNil(redirectPath)) {
history.push(`/tos_acceptance`);
} else {
Expand Down
5 changes: 0 additions & 5 deletions src/pages/TermsOfServiceAcceptance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { useCallback, useEffect, useState } from 'react';
import { Auth } from '../libs/auth/auth';
import { TosService } from '../libs/tosService';
import { Storage } from '../libs/storage';
import SimpleButton from '../components/SimpleButton';
import { Theme } from '../libs/theme';

Expand All @@ -20,10 +19,6 @@ export default function TermsOfServiceAcceptance(props) {

const acceptToS = useCallback(async () => {
await TosService.acceptTos();
// TODO: Determine if this is the correct user flow
// Can the user only accept ToS once the have signed in?
// What state is the user in after signIn, but before accepting ToS?
await Storage.setUserIsLogged(true);

// if there is a redirectTo, we should go to that. otherwise, just go to the appropriate
// user's profile.
Expand Down

0 comments on commit 5caaf3c

Please sign in to comment.