Skip to content

Commit 1c7409d

Browse files
committed
Implementing login process using ReCodEx temp token.
1 parent dbd8d10 commit 1c7409d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+157
-1069
lines changed

bin/dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import fs from 'fs';
1010
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
1111
const __dirname = path.dirname(__filename); // get the name of the directory
1212

13-
const WEBPACK_DEV_SERVER_PORT = process.env.WEBPACK_DEV_SERVER_PORT || 8081;
13+
const WEBPACK_DEV_SERVER_PORT = process.env.WEBPACK_DEV_SERVER_PORT || 8085;
1414
const fileConfig = fs.readFileSync('etc/env.json', 'utf8');
1515
const parsedConfig = JSON.parse(fileConfig);
1616
const PORT = parsedConfig.PORT;

etc/env.json.devel

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"PORT": 8080,
3-
"API_BASE": "https://recodex-devel.ms.mff.cuni.cz:4000/v1",
2+
"PORT": 8084,
3+
"API_BASE": "https://recodex-devel.ms.mff.cuni.cz:4004",
44
"TITLE": "SIS-CodEx",
55
"SKIN": "danger",
66
"URL_PATH_PREFIX": "",

etc/env.json.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"PORT": 8080,
3-
"API_BASE": "https://recodex.base.domain/api/v1",
3+
"API_BASE": "https://recodex.base.domain/api",
44
"TITLE": "SIS-CodEx",
55
"SKIN": "success",
66
"URL_PATH_PREFIX": "",
7-
"PERSISTENT_TOKENS_KEY_PREFIX": "rex-sis"
7+
"PERSISTENT_TOKENS_KEY_PREFIX": "rex-sis-devel"
88
}

etc/env.json.local

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"PORT": 8080,
3-
"API_BASE": "http://127.0.0.1:4000/v1",
2+
"PORT": 8084,
3+
"API_BASE": "http://127.0.0.1:4004",
44
"TITLE": "SIS-CodEx",
55
"SKIN": "warning",
66
"URL_PATH_PREFIX": "",
7-
"PERSISTENT_TOKENS_KEY_PREFIX": "rex-sis-local"
7+
"PERSISTENT_TOKENS_KEY_PREFIX": "rex-sis-devel"
88
}

etc/env.json.test

-8
This file was deleted.

src/client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Provider } from 'react-redux';
77
import { BrowserRouter } from 'react-router-dom';
88

99
import { configureOurStore } from './redux/store.js';
10-
import { getToken, getInstanceId } from './redux/middleware/authMiddleware.js';
10+
import { getToken } from './redux/middleware/authMiddleware.js';
1111
import { getLang } from './redux/middleware/langMiddleware.js';
1212
import App from './containers/App/index.js';
1313

@@ -66,7 +66,7 @@ if (ini) {
6666
});
6767
}
6868

69-
const store = configureOurStore(state, getToken(), getInstanceId(), getLang());
69+
const store = configureOurStore(state, getToken(), getLang());
7070

7171
const container = document.getElementById('root');
7272
const root = createRoot(container);

src/components/Users/UsersName/FailedUsersName.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { FormattedMessage } from 'react-intl';
4-
import { FailedAvatar } from '../../widgets/Avatar';
54

65
import * as styles from './usersName.less';
76

87
const FailedUsersName = ({ size = 25 }) => (
98
<span className={styles.wrapper}>
10-
<span className={styles.avatar}>
11-
<FailedAvatar size={size} />
12-
</span>
139
<span style={{ lineHeight: `${size}px` }}>
1410
<FormattedMessage id="generic.loading" defaultMessage="Loading..." />
1511
</span>

src/components/Users/UsersName/LoadingUsersName.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { FormattedMessage } from 'react-intl';
4-
import { LoadingAvatar } from '../../widgets/Avatar';
54

65
import * as styles from './usersName.less';
76

87
const LoadingUsersName = ({ size = 22 }) => (
98
<span className={styles.wrapper}>
10-
<span className={styles.avatar}>
11-
<LoadingAvatar light size={size} />
12-
</span>
139
<span style={{ lineHeight: `${size}px` }}>
1410
<FormattedMessage id="generic.loading" defaultMessage="Loading..." />
1511
</span>

src/components/Users/UsersName/UsersName.js

-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { FormattedMessage } from 'react-intl';
66
import { CopyToClipboard } from 'react-copy-to-clipboard';
77
import { lruMemoize } from 'reselect';
88

9-
import AvatarContainer from '../../../containers/AvatarContainer/AvatarContainer.js';
109
import { UserRoleIcon } from '../../helpers/usersRoles.js';
1110
import Icon, { MailIcon, BanIcon } from '../../icons';
1211
import withLinks from '../../../helpers/withLinks.js';
@@ -42,12 +41,10 @@ const assembleName = ({ titlesBeforeName = '', firstName, lastName, titlesAfterN
4241

4342
const UsersName = ({
4443
id,
45-
avatarUrl,
4644
name,
4745
size = null,
4846
large = false,
4947
link = false,
50-
noAvatar = false,
5148
privateData = null,
5249
showEmail = null,
5350
showExternalIdentifiers = false,
@@ -65,11 +62,6 @@ const UsersName = ({
6562

6663
return (
6764
<span className={styles.wrapper}>
68-
{(!privateData || privateData.isAllowed) && !noAvatar && (
69-
<span className={styles.avatar}>
70-
<AvatarContainer avatarUrl={avatarUrl} fullName={fullName} firstName={name.firstName} size={size} />
71-
</span>
72-
)}
7365
<span style={userNameStyle(size, large)}>
7466
{privateData && !privateData.isAllowed && (
7567
<BanIcon
@@ -179,12 +171,10 @@ UsersName.propTypes = {
179171
lastName: PropTypes.string.isRequired,
180172
titlesAfterName: PropTypes.string,
181173
}).isRequired,
182-
avatarUrl: PropTypes.string,
183174
privateData: PropTypes.object,
184175
size: PropTypes.number,
185176
large: PropTypes.bool,
186177
link: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.bool]),
187-
noAvatar: PropTypes.bool,
188178
showEmail: PropTypes.string,
189179
showExternalIdentifiers: PropTypes.bool,
190180
showRoleIcon: PropTypes.bool,

src/components/Users/UsersName/usersName.less

-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,3 @@
1010
white-space: initial;
1111
}
1212
}
13-
14-
.avatar {
15-
margin-right: 8px;
16-
vertical-align: text-top;
17-
line-height: 100%;
18-
}

src/components/helpers/exams.js

-23
This file was deleted.

src/components/helpers/users.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const createUserNameComparator = locale => (u1, u2) => {
1010
return (
1111
u1.name.lastName.localeCompare(u2.name.lastName, locale) ||
1212
u1.name.firstName.localeCompare(u2.name.firstName, locale) ||
13-
(u1.privateData && u2.privateData && u1.privateData.email.localeCompare(u2.privateData.email, locale)) || // email is used in rare cases when two users have the same name
13+
u1.email.localeCompare(u2.email, locale) || // email is used in rare cases when two users have the same name
1414
u1.id.localeCompare(u2.id) // ultimate fallback (since email may not be visible to regular users)
1515
);
1616
};

src/components/layout/Header/Header.js

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ class Header extends Component {
4444

4545
Header.propTypes = {
4646
isLoggedIn: PropTypes.bool,
47-
toggleSidebarSize: PropTypes.func.isRequired,
48-
toggleSidebarVisibility: PropTypes.func.isRequired,
4947
currentLang: PropTypes.string.isRequired,
5048
setLang: PropTypes.func.isRequired,
5149
availableLangs: PropTypes.array,

src/components/layout/Sidebar/Admin.js

-54
This file was deleted.

src/components/layout/Sidebar/Sidebar.js

+6-77
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,17 @@ import MenuTitle from '../../widgets/Sidebar/MenuTitle';
1111
import MenuItem from '../../widgets/Sidebar/MenuItem';
1212
import { LoadingIcon } from '../../icons';
1313
import { getJsData } from '../../../redux/helpers/resourceManager';
14-
import { isSupervisorRole, isEmpoweredSupervisorRole, isSuperadminRole } from '../../helpers/usersRoles.js';
14+
import { isSupervisorRole, isSuperadminRole } from '../../helpers/usersRoles.js';
1515
import withLinks from '../../../helpers/withLinks.js';
16-
import { getExternalIdForCAS } from '../../../helpers/cas.js';
1716
import { getConfigVar } from '../../../helpers/config.js';
18-
import Admin from './Admin.js';
1917

2018
import './sidebar.css';
2119

2220
const URL_PREFIX = getConfigVar('URL_PATH_PREFIX');
2321

2422
const getUserData = lruMemoize(user => getJsData(user));
2523

26-
const Sidebar = ({
27-
pendingFetchOperations,
28-
loggedInUser,
29-
effectiveRole = null,
30-
currentUrl,
31-
links: {
32-
HOME_URI,
33-
FAQ_URL,
34-
LOGIN_URI,
35-
REGISTRATION_URI,
36-
DASHBOARD_URI,
37-
EXERCISES_URI,
38-
PIPELINES_URI,
39-
ARCHIVE_URI,
40-
SIS_INTEGRATION_URI,
41-
},
42-
}) => {
24+
const Sidebar = ({ pendingFetchOperations, loggedInUser, currentUrl, links: { HOME_URI } }) => {
4325
const user = getUserData(loggedInUser);
4426

4527
return (
@@ -84,14 +66,7 @@ const Sidebar = ({
8466
title={<FormattedMessage id="app.sidebar.menu.signIn" defaultMessage="Sign in" />}
8567
icon="sign-in-alt"
8668
currentPath={currentUrl}
87-
link={LOGIN_URI}
88-
/>
89-
<MenuItem
90-
title={<FormattedMessage id="app.sidebar.menu.createAccount" defaultMessage="Create account" />}
91-
isActive={false}
92-
icon="user-plus"
93-
currentPath={currentUrl}
94-
link={REGISTRATION_URI}
69+
link={HOME_URI}
9570
/>
9671
</ul>
9772
)}
@@ -104,58 +79,13 @@ const Sidebar = ({
10479
role="menu"
10580
data-accordion="false">
10681
<MenuTitle title={<FormattedMessage id="app.sidebar.menu.title" defaultMessage="Menu" />} />
107-
<MenuItem
108-
title={<FormattedMessage id="app.sidebar.menu.dashboard" defaultMessage="Dashboard" />}
109-
icon="tachometer-alt"
110-
currentPath={currentUrl}
111-
link={DASHBOARD_URI}
112-
/>
113-
114-
{isSupervisorRole(effectiveRole) && (
115-
<MenuItem
116-
title={<FormattedMessage id="app.sidebar.menu.exercises" defaultMessage="Exercises" />}
117-
icon="puzzle-piece"
118-
currentPath={currentUrl}
119-
link={EXERCISES_URI}
120-
/>
121-
)}
82+
<MenuItem title="TODO" icon="tachometer-alt" currentPath={currentUrl} link="TODO" />
12283

123-
{isEmpoweredSupervisorRole(effectiveRole) && (
124-
<MenuItem
125-
title={<FormattedMessage id="app.sidebar.menu.pipelines" defaultMessage="Pipelines" />}
126-
icon="random"
127-
currentPath={currentUrl}
128-
link={PIPELINES_URI}
129-
/>
130-
)}
131-
132-
<MenuItem
133-
title={<FormattedMessage id="app.sidebar.menu.archive" defaultMessage="Archive" />}
134-
icon="archive"
135-
currentPath={currentUrl}
136-
link={ARCHIVE_URI}
137-
/>
138-
139-
{Boolean(getExternalIdForCAS(user)) && (
140-
<MenuItem
141-
icon="id-badge"
142-
title={<FormattedMessage id="app.sidebar.menu.admin.sis" defaultMessage="SIS Integration" />}
143-
currentPath={currentUrl}
144-
link={SIS_INTEGRATION_URI}
145-
/>
146-
)}
147-
148-
<MenuItem
149-
title={<FormattedMessage id="app.sidebar.menu.faq" defaultMessage="FAQ" />}
150-
icon={['far', 'question-circle']}
151-
link={FAQ_URL}
152-
currentPath={currentUrl}
153-
/>
84+
{isSupervisorRole(user.role) && <></>}
85+
{isSuperadminRole(user.role) && <></>}
15486
</ul>
15587
</>
15688
)}
157-
158-
{isSuperadminRole(effectiveRole) && <Admin currentUrl={currentUrl} />}
15989
</nav>
16090
</div>
16191
</div>
@@ -166,7 +96,6 @@ const Sidebar = ({
16696
Sidebar.propTypes = {
16797
pendingFetchOperations: PropTypes.bool,
16898
loggedInUser: ImmutablePropTypes.map,
169-
effectiveRole: PropTypes.string,
17099
currentUrl: PropTypes.string,
171100
links: PropTypes.object,
172101
};

src/components/widgets/Avatar/Avatar.js

-21
This file was deleted.

0 commit comments

Comments
 (0)