Skip to content

Commit

Permalink
Feide Update (#1053)
Browse files Browse the repository at this point in the history
* chore(deps): bump @babel/traverse from 7.22.15 to 7.23.2 (#912)

Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.15 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: cleanup calendar pup-up (#913)

* chore: cleanup calendar pup-up

* chore: update conditions

* fix: formatting

* chore: added emoji ➡️

* chore: remove emoji 😥

* chore: fix pre-commit file permissions

* chore(deps-dev): bump postcss from 8.4.29 to 8.4.31 (#904)

Bumps [postcss](https://github.com/postcss/postcss) from 8.4.29 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](postcss/postcss@8.4.29...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Feat(event)/waitlist (#911)

* Feat/event add users maunually (#917)

* Added api endpoints locally and hooks

* Added component and ui part

* Small fix, only allow one person to be added

* Updated Changelog

* Update CHANGELOG.md

* Trigger build

* made page for creating and deleting QR codes (#907)

* made page for creating and deleting QR codes

* added error for invalid url, and download option

* commit

* fixed the error with deleting qr code

* Update CHANGELOG.md

* added error for invalid url

* changed to qr generations at frontend

* format

* refactored to use QR code generator at frontend, and styled the component

* fixes

* format

* Activity (#922)

* first version

* changed layout for activities on landing page

* changed limit for activities on landing page

* Update CHANGELOG.md

* vite 5.0.0 update (#928)

chore: vite 5.0.0 update

* added buttuns for filtering (#924)

* added buttuns for filtering

* added filter for expired events

* fix

* fixed filtering of events and activities (#939)

* Reaksjoner (#900)

* moved share button below news post instead of above

* moved share button below news post instead of above

* startet adding checkbox for emojis

* started adding emojis

* fixed bug with newseditor

* saving progress

* added test mui components for displaying emojis

* Your commit message

* fikset logikken for emojies

* added emoji picker for react

* added emoji picker for react

* started adding mutation

* fixed fetching and started on designing

* redesigned

* started om emojis for event

* added emojies for events

* fixed design for mobile

* redesigned to displaying users

* format

* removed yarn file

* added ContentType type

---------

Co-authored-by: 1Cezzo <emiljohnzen@gmail.com>
Co-authored-by: Jonatan <jonatanv@stud.ntnu.no>
Co-authored-by: Jarand Romestrand <jarandjr@stud.ntnu.no>

* moved checkbox for emojies outside paid event collapse

* added id for each user in copy of participants of an event (#940)

* disabled switch to change from free to paid event if an event has reg… (#910)

* disabled switch to change from free to paid event if an event has registrations

* first version finished

* Update CHANGELOG.md

* format

* fixed wrong disable logic for switching off paid event

* Update CHANGELOG.md

* fixed countdowntimer bug, so if the time is out and there is an error in the backend, the timer will disapear

* fixed countdowntimer bug

* added message for when time is out, explaining why the user is not kicked out before extra payment time is out

* changed message for signing off event

* format

* changed text (#944)

* changed email for strike message (#945)

* added package for allowing iframe (#949)

* reduced number of showcase to two for mobile fit (#950)

* Update CHANGELOG.md (#951)

* added helpertext (#957)

* removed timepicker. Paytime is set to constant 2 hours (#958)

* Update CHANGELOG.md (#959)

* Clickable user component in reactions list (#961)

* changed cheatsheet button (#962)

* Feat/paragraph description (#963)

* Added description to fine

* Updated changelog

* Fixed rendering error when no laws

* Fix(waiting list)/fix waiting list order (#965)

* will now sort and render the waiting list participants according to their respective waiting list number

* added waiting list number field to participant info

* added tailwindcss and shadcn (#964)

* added tailwindcss and shadcn

* added clsx package for utils.ts

* changed to outlined on contained buttons to fix css bug

* added old bg colors to tailwindcss config

* redesigned reaction handler

* removed full import from React in button.tsx

* removed full import from react in card.tsx

* added old primary colors to index.css

* changed icon for showing all reacitons

* Update CHANGELOG.md (#966)

* waiting-list will now only be sorted if there is a priority pool (#968)

* waiting list info will now only be rendered if not null (#969)

* Shadcn button refdesign (#970)

* changed button for add fine

* changed button for adding prioritygroups

* changed button for image upload

* Shadcn redesign footer (#971)

* fixed long text on image upload and removed hover on small devices

* refactord footer to shadcn

* fixed pnpm-lock

* Refactor(shadcn)/markdown (#974)

* fixed markdown bugs

* format

* fixed link for event calender (#976)

* redesigned to shadcn avatars (#977)

* changed themesettings component to shadcn (#978)

* fixed seperator for markdown (#981)

* fixed seperator for markdown (#982)

* Refactor event renderer (#983)

* init

* refactored event renderer

* added change to changelog

* started on redesign of profile page (#980)

* started on redesign of profile page

* redesinged event subscription collapse

* redesigned admin cards

* refactored badge listing

* refactored membershippage

* started on strike listing

* refactored strike listing

* finished

* added change to changelog

* chore(deps): bump eslint from 8.48.0 to 8.56.0 (#941)

Bumps [eslint](https://github.com/eslint/eslint) from 8.48.0 to 8.56.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.48.0...v8.56.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com>

* docs(changelog): iterate changelog version (#919)

Co-authored-by: MadsNyl <MadsNyl@users.noreply.github.com>
Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com>

* refactored news renderer (#989)

* chore(deps): bump @emotion/react from 11.9.0 to 11.11.4 (#988)

Bumps [@emotion/react](https://github.com/emotion-js/emotion) from 11.9.0 to 11.11.4.
- [Release notes](https://github.com/emotion-js/emotion/releases)
- [Changelog](https://github.com/emotion-js/emotion/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emotion-js/emotion/compare/@emotion/react@11.9.0...@emotion/react@11.11.4)

---
updated-dependencies:
- dependency-name: "@emotion/react"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump @vercel/analytics from 1.0.2 to 1.1.4 (#984)

Bumps [@vercel/analytics](https://github.com/vercel/analytics/tree/HEAD/packages/web) from 1.0.2 to 1.1.4.
- [Release notes](https://github.com/vercel/analytics/releases)
- [Commits](https://github.com/vercel/analytics/commits/1.1.4/packages/web)

---
updated-dependencies:
- dependency-name: "@vercel/analytics"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump react-router-dom from 6.15.0 to 6.22.3 (#985)

* chore(deps): bump react-router-dom from 6.15.0 to 6.22.3

Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.15.0 to 6.22.3.
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.22.3/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed pnpm-lock

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com>
Co-authored-by: Mads Nylund <madsnyl@gmail.com>

* chore(deps-dev): bump vite from 5.0.0 to 5.0.12 (#956)

* chore(deps-dev): bump vite from 5.0.0 to 5.0.12

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.0 to 5.0.12.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.0.12/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.0.12/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed pnpm-lock

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mads Nylund <73914541+MadsNyl@users.noreply.github.com>
Co-authored-by: Mads Nylund <madsnyl@gmail.com>

* Update CHANGELOG.md (#990)

* fixed ts error

* added description of how to use spaces (#992)

* changed position of share and edit button for event (#993)

changed position of share and edit button

* diasbled theme selector (#998)

* NITO logo footer (#1002)

added nito logo and made news title bigger on mobile

* added version name to changelog

* trigger build

* Menu for shortcuts (#1006)

* init

* added shortcut navigations for external sites

* Changed icon and added logout button

* changed info for contact for strikes (#1007)

changed info for contact

* changed changelog

* User bio (#1010)

* Created initial profileBio

* Started on bio editor

* made the frame for bio editor

* Create user_bio type and add api calls for user bio

* Create user_bio type and added it to user type. Added api calls for user bio. Created hooks.

* Refactor: Changed the gui in edit bio

* Refactor: Fixed User bio editor

* format

* Enable partial updates

* format

* finished

---------

Co-authored-by: Ester2109 <126612066+Ester2109@users.noreply.github.com>
Co-authored-by: Harry Linrui XU <xulr0820@hotmail.com>

* Update CHANGELOG.md

* PNG image bg fix (#1013)

removed white bg

* removed unregister button if registration is paid (#1015)

* removed unregister button if registration is paid

* update changelog

* sort after category (#1018)

* sort after category

* fixed event cateogry type

* fixed eventlist type

* made sepearte eventlist type

* fixed type error

* fixed category for event view (#1020)

* Remove MUI from Navigation (#1028)

* converted navigation to not use mui, and went away from navigation hook

* removed unused props from TihldeLogo component

* Remove MUI from signin pages (#1030)

removed mui from signin, signup and forgot password

* Remove Page component (#1031)

removed Page component

* Replace MUI with ShadCN (#1038)

* upgraded to react 18 types

* removed mui from most of the pages

* refactored gallery page

* refactored index changelog page

* wikitree update

* wikietree update

* done with wiki

* removed unused files

* finished with pages

* removed all mui imports

* removed mui and other unsued dependencies

* changelog

* fixed small design bugs  and added scrollToTop component (#1040)

* fixed small design bugs  and added scrollToTop component

* trigger build

* removed scrolltotop

* changed scrolltotop component

* changed version of pnpm/action-setup to fix known bug

* feat(changelog)/changelog site for logged in users (#1045)

* Added navbar destination for changelog

* Export changelog URLs to use in changelog page

* Add classname prop to used components

Makes it easier to customize styling via tailwind

* Created page and added routing destination

* Updated CHANGELOG.md

* Fix navbar columns for md and lg breakpoints

* Undid changelog formatting

* Fix bugs (#1044)

Co-authored-by: Anton Tveito <anton_tveito@Antons-MacBook-Air.local>

* Fix accordion stutter (#1043)

Pass p-4 to children in Expandable to fix opening/closing stutter

* updated changelog.md

* Redesing of Ny student page (#1050)

* added 'pnpm dev'

* finished first draft of the new new student page

* added light mode

* added mobile layout

---------

Co-authored-by: Embret Olav Rasmussen Roås <embret.roas@outlook.com>

* added new button for wiki page redirect

* fixed small writing error

* created option for registration with FEIDE

* changelog update

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Clementz <martcl@stud.ntnu.no>
Co-authored-by: martcl <martincclementz@gmail.com>
Co-authored-by: Anders <69890033+lille-morille@users.noreply.github.com>
Co-authored-by: Ester2109 <126612066+Ester2109@users.noreply.github.com>
Co-authored-by: 1Cezzo <emiljohnzen@gmail.com>
Co-authored-by: Jonatan <jonatanv@stud.ntnu.no>
Co-authored-by: Jarand Romestrand <jarandjr@stud.ntnu.no>
Co-authored-by: Emil Johnsen <111747340+1Cezzo@users.noreply.github.com>
Co-authored-by: Frikk Balder <33499052+MindChirp@users.noreply.github.com>
Co-authored-by: Erik Skjellevik <98759397+eriskjel@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: MadsNyl <MadsNyl@users.noreply.github.com>
Co-authored-by: LeMiTam <145369879+LeMiTam@users.noreply.github.com>
Co-authored-by: Harry Linrui XU <xulr0820@hotmail.com>
Co-authored-by: antontveito <64641278+antontveito@users.noreply.github.com>
Co-authored-by: Anton Tveito <anton_tveito@Antons-MacBook-Air.local>
Co-authored-by: Markus <113692526+MarkussMadsbakken@users.noreply.github.com>
Co-authored-by: Embret Olav Rasmussen Roås <embret.roas@outlook.com>
  • Loading branch information
20 people committed Jul 30, 2024
1 parent 65b9c0c commit f5623cd
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

## Neste versjon

## Versjon 2024.30.07
-**Feide**. Man kan nå registrere bruker automatisk med Feide.

## Versjon 2024.29.07
- 🎨 **Ny student**. Ny student side er redesignet.

Expand Down
6 changes: 5 additions & 1 deletion src/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const Wiki = lazy(() => import('pages/Wiki'));
const ShortLinks = lazy(() => import('pages/ShortLinks'));
const QRCodes = lazy(() => import('pages/QRCodes'));
const SignUp = lazy(() => import('pages/SignUp'));
const SignUpOptions = lazy(() => import('pages/SignUpOptions'));
const SignUpFeide = lazy(() => import('pages/SignUpFeide'));
const StrikeAdmin = lazy(() => import('pages/StrikeAdmin'));
const Toddel = lazy(() => import('pages/Toddel'));
const UserAdmin = lazy(() => import('pages/UserAdmin'));
Expand Down Expand Up @@ -168,7 +170,9 @@ const AppRoutes = () => {

<Route element={<LogIn />} path={URLS.login} />
<Route element={<ForgotPassword />} path={URLS.forgotPassword} />
<Route element={<SignUp />} path={URLS.signup} />
<Route element={<SignUp />} path={URLS.signupForm} />
<Route element={<SignUpOptions />} path={URLS.signup} />
<Route element={<SignUpFeide />} path={URLS.signupFeide} />

<Route element={<Changelog />} path={URLS.changelog} />

Expand Down
2 changes: 2 additions & 0 deletions src/URLS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const URLS = {
aboutIndex: `${WIKI}${WIKI_URLS.ABOUT_INDEX}`,
profile: '/profil/',
signup: '/ny-bruker/',
signupForm: '/ny-bruker/skjema/',
signupFeide: '/ny-bruker/feide/',
shortLinks: '/linker/',
qrCodes: '/qr-koder/',
gallery: '/galleri/',
Expand Down
4 changes: 4 additions & 0 deletions src/api/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const WARNINGS_ENDPOINT = 'warnings';
export const PAYMENT_ENDPOINT = 'payments';
export const EMOJI_ENDPOINT = 'emojis';
export const BIO_ENDPOINT = 'user-bios/';
export const FEIDE_ENDPOINT = 'feide/';

export default {
// Auth
Expand Down Expand Up @@ -239,6 +240,9 @@ export default {
exportUserData: () => IFetch<RequestResponse>({ method: 'GET', url: `${USERS_ENDPOINT}/${ME_ENDPOINT}/data/` }),
deleteUser: (userId?: User['user_id']) => IFetch<RequestResponse>({ method: 'DELETE', url: `${USERS_ENDPOINT}/${userId || ME_ENDPOINT}/` }),

// Feide
feideAuthenticate: (code: string) => IFetch<RequestResponse>({ method: 'POST', url: FEIDE_ENDPOINT, data: { code }, withAuth: false }),

// Notifications
getNotifications: (filters?: any) => IFetch<PaginationResponse<Notification>>({ method: 'GET', url: `${NOTIFICATIONS_ENDPOINT}/`, data: filters || {} }),
updateNotification: (id: number, item: { read: boolean }) =>
Expand Down
1 change: 1 addition & 0 deletions src/assets/icons/feide.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ import { isAfterDateOfYear, isBeforeDateOfYear } from 'utils';
* Url to backend
*/
export const TIHLDE_API_URL = import.meta.env.VITE_API_URL;
/**
* Client ID for Feide application
*/
export const FEIDE_CLIENT_ID = import.meta.env.VITE_FEIDE_CLIENT_ID;
/**
* Redirect URI for Feide application
*/
export const FEIDE_REDIRECT_URI = import.meta.env.VITE_FEIDE_REDIRECT_URI;
/**
* Authn state for Feide application
*/
export const FEIDE_AUTH_STATE = import.meta.env.VITE_FEIDE_AUTH_STATE;
/**
* Feide Auth Url
*/
export const FEIDE_AUTH_URL = 'https://auth.dataporten.no/oauth/authorization';
/**
* Name of auth-token which is sent to backend to authenticate the user
*/
Expand Down
3 changes: 3 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

interface ImportMetaEnv {
readonly VITE_API_URL: string;
readonly VITE_FEIDE_CLIENT_ID?: string;
readonly VITE_FEIDE_REDIRECT_URI?: string;
readonly VITE_FEIDE_AUTH_STATE?: string;
readonly VITE_SLACK_CLIENT_ID?: string;
}

Expand Down
8 changes: 4 additions & 4 deletions src/pages/SignUp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const SignUp = () => {
<CardContent>
<Form {...form}>
<form className='space-y-6' onSubmit={form.handleSubmit(onSignUp)}>
<div className='flex space-x-4'>
<div className='space-y-6 md:space-y-0 md:flex md:space-x-4'>
<FormField
control={form.control}
name='first_name'
Expand Down Expand Up @@ -133,7 +133,7 @@ const SignUp = () => {
/>
</div>

<div className='flex space-x-4'>
<div className='space-y-6 md:space-y-0 md:flex md:space-x-4'>
<FormField
control={form.control}
name='user_id'
Expand Down Expand Up @@ -169,7 +169,7 @@ const SignUp = () => {
/>
</div>

<div className='flex space-x-4'>
<div className='space-y-6 md:space-y-0 md:flex md:space-x-4'>
<FormField
control={form.control}
name='study'
Expand Down Expand Up @@ -228,7 +228,7 @@ const SignUp = () => {
/>
</div>

<div className='flex space-x-4'>
<div className='space-y-6 md:space-y-0 md:flex md:space-x-4'>
<FormField
control={form.control}
name='password'
Expand Down
109 changes: 109 additions & 0 deletions src/pages/SignUpFeide/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { FEIDE_AUTH_STATE } from 'constant';
import { ArrowRight, LoaderCircle, ShieldAlert } from 'lucide-react';
import { useEffect, useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import URLS from 'URLS';

import { User } from 'types';

import API from 'api/api';

import Page from 'components/navigation/Page';
import { Button } from 'components/ui/button';
import { Card, CardContent } from 'components/ui/card';

const SignUpFeide = () => {
const location = useLocation();
const [queryError, setQueryError] = useState<string>();
const [feideError, setFeideError] = useState<string>();
const [isLoading, setIsLoading] = useState<boolean>(false);
const [createdUser, setCreatedUser] = useState<User>();

const createUser = async (code: string) => {
setIsLoading(true);
try {
const user = await API.feideAuthenticate(code);
setCreatedUser(user.detail as unknown as User);
} catch (error) {
setFeideError(error.detail || 'En feil oppstod under autentisering, vennligst prøv igjen.');
} finally {
setIsLoading(false);
}
};

useEffect(() => {
const queryParams = new URLSearchParams(location.search);
const code = queryParams.get('code');
const state = queryParams.get('state');

if (!code || !state || state !== FEIDE_AUTH_STATE) {
setQueryError('Mangler påkrevde parametere, vennligst prøv igjen.');
return;
}

createUser(code);
}, [location]);

return (
<Page className='mt-12'>
<div className='max-w-xl w-full mx-auto'>
{queryError && (
<div className='space-y-8'>
<h1 className='text-center'>{queryError}</h1>

<div className='flex justify-center'>
<Button asChild variant='ghost'>
<Link to={URLS.signup}>
Opprett bruker
<ArrowRight className='ml-2 w-5 h-5 stroke-[1.5px]' />
</Link>
</Button>
</div>
</div>
)}

{isLoading && (
<div className='space-y-8'>
<LoaderCircle className='mx-auto animate-spin w-12 h-12' />
<h1 className='text-center text-2xl font-bold'>Oppretter bruker...</h1>
</div>
)}

{feideError && (
<div className='space-y-8 '>
<ShieldAlert className='mx-auto w-16 h-16 text-red-500' />
<h1 className='text-center'>{feideError}</h1>

<div className='flex justify-center'>
<Button asChild variant='ghost'>
<Link to={URLS.signup}>
Gå tilbake til registrering
<ArrowRight className='ml-2 w-5 h-5 stroke-[1.5px]' />
</Link>
</Button>
</div>
</div>
)}

{createdUser && (
<Card>
<CardContent className='p-8 space-y-8'>
<h1 className='text-center text-2xl font-bold'>Velkommen til TIHLDE!</h1>

<p>
Du har nå fått opprettet en bruker med brukernavn <span className='font-bold'>{createdUser.user_id}</span>. Din bruker er nå klar til bruk, og
ditt autogenererte passord er sendt til din e-post <span className='font-bold'>{createdUser.email}</span>.
</p>

<Button asChild className='w-full'>
<Link to={URLS.login}>Logg inn</Link>
</Button>
</CardContent>
</Card>
)}
</div>
</Page>
);
};

export default SignUpFeide;
49 changes: 49 additions & 0 deletions src/pages/SignUpOptions/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { FEIDE_AUTH_STATE, FEIDE_AUTH_URL, FEIDE_CLIENT_ID, FEIDE_REDIRECT_URI } from 'constant';
import { Link } from 'react-router-dom';
import URLS from 'URLS';

import TihldeLogo from 'components/miscellaneous/TihldeLogo';
import Page from 'components/navigation/Page';
import { Button } from 'components/ui/button';
import { Card, CardContent } from 'components/ui/card';

import FEIDE_ICON from 'assets/icons/feide.svg';

const SignUpOptions = () => {
const createFeideSession = () => {
const url = `${FEIDE_AUTH_URL}?client_id=${FEIDE_CLIENT_ID}&response_type=code&redirect_uri=${FEIDE_REDIRECT_URI}&scope=openid&state=${FEIDE_AUTH_STATE}`;

window.location.replace(url);
};

return (
<Page className='mt-12'>
<Card className='max-w-2xl w-full mx-auto'>
<CardContent className='space-y-12 p-8'>
<div className='space-y-4'>
<h1 className='text-2xl font-bold'>Opprett bruker hos TIHLDE</h1>
<p className='text-sm text-muted-foreground'>
Vi anbefaler å registrere bruker automatisk ved hjelp av Feide. På denne måten vil du få tilgang til TIHLDE sine plattformer umiddelbart. Hvis du
ikke har Feide bruker enda, eller om det skulle oppstå et problem kan du registrere deg manuelt. Da trenger vi bevis på at du studerer ved ett av
TIHLDE sine studieretninger for å registrere brukeren din.
</p>
</div>
<div className='w-full space-y-2 md:space-y-0 md:flex md:items-center md:space-x-4'>
<Button className='w-full' onClick={createFeideSession} size='lg'>
<img alt='Feide ikon' className='mr-2 w-5 h-5' src={FEIDE_ICON} />
Feide
</Button>
<Button asChild className='w-full' size='lg' variant='outline'>
<Link to={URLS.signupForm}>
<TihldeLogo className='m-0 w-6 h-6 mr-2' size='small' />
Manuelt
</Link>
</Button>
</div>
</CardContent>
</Card>
</Page>
);
};

export default SignUpOptions;

0 comments on commit f5623cd

Please sign in to comment.