Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Profile view #43

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
82 changes: 41 additions & 41 deletions components/Layout/Public/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
import Link from 'next/link';
import React from 'react';
import Link from 'next/link'
import React from 'react'
const Footer = () => {
return (
<footer id='footer' className='relative z-2 m-auto max-w-7xl text-center'>
<div className='pt-8 mx-auto container px-4 xl:px-12 2xl:px-4 lg:flex'>
<div className='w-full lg:w-1/2 mb-10 lg:mb-0 flex'>
<div className='w-full lg:w-1/2 px-6'>
<footer id="footer" className="relative z-2 m-auto max-w-7xl text-center">
<div className="pt-8 mx-auto container px-4 xl:px-12 2xl:px-4 lg:flex">
<div className="w-full mb-10 lg:mb-0 flex">
<div className="w-full lg:w-1/2 px-6">
<ul>
<li>
<Link href='/info/about'>
<a className='text-md lg:text-sm leading-none hover:text-accent'>
<Link href="/info/about">
<a className="text-md lg:text-sm leading-none hover:text-accent">
About
</a>
</Link>
</li>
<li className='mt-3'>
<Link href='/info/faq'>
<a className='text-md lg:text-sm leading-none hover:text-accent'>
<li className="mt-3">
<Link href="/info/faq">
<a className="text-md lg:text-sm leading-none hover:text-accent">
FAQ
</a>
</Link>
</li>
</ul>
</div>
<div className='w-full lg:w-1/2 px-6'>
<div className="w-full lg:w-1/2 px-6">
<ul>
<li>
<Link href='/info/blog'>
<a className='text-md lg:text-sm leading-none hover:text-accent '>
<Link href="/info/blog">
<a className="text-md lg:text-sm leading-none hover:text-accent ">
Blog
</a>
</Link>
</li>
<li className='mt-3'>
<Link href='/info/changelog'>
<a className='text-md lg:text-sm leading-none hover:text-accent '>
<li className="mt-3">
<Link href="/info/changelog">
<a className="text-md lg:text-sm leading-none hover:text-accent ">
Changelog
</a>
</Link>
</li>
</ul>
</div>
</div>
<div className='w-full lg:w-1/2 flex'>
<div className='w-full lg:w-1/2 px-6'>
<div className="w-full lg:w-1/2 flex">
<div className="w-full lg:w-1/2 px-6">
<ul>
<li>
<a
href='/info/privacy-policy'
className='text-md lg:text-sm leading-none hover:text-accent '
href="/info/privacy-policy"
className="text-md lg:text-sm leading-none hover:text-accent "
>
Privacy policy
</a>
</li>
<li className='mt-3'>
<Link href='/info/terms-of-service'>
<a className='text-md lg:text-sm leading-none hover:text-accent '>
<li className="mt-3">
<Link href="/info/terms-of-service">
<a className="text-md lg:text-sm leading-none hover:text-accent ">
Terms of service
</a>
</Link>
</li>
</ul>
</div>
<div className='w-full lg:w-1/2 px-6 flex justify-center'>
<a href='https://github.com/JohanAOstbye'>
<div className=' cursor-pointer hover:text-accent'></div>
<div className="w-full lg:w-1/2 px-6 flex justify-center">
<a href="https://github.com/JohanAOstbye">
<div className=" cursor-pointer hover:text-accent"></div>
</a>
<a href='https://twitter.com/twitter'>
<div className='pl-4 hover:text-accent'></div>
<a href="https://twitter.com/twitter">
<div className="pl-4 hover:text-accent"></div>
</a>
<a href='https://play.google.com/store'>
<div className='pl-4 hover:text-accent'></div>
<a href="https://play.google.com/store">
<div className="pl-4 hover:text-accent"></div>
</a>
<a href='https://www.apple.com/no/app-store/'>
<div className='pl-4 hover:text-accent'></div>
<a href="https://www.apple.com/no/app-store/">
<div className="pl-4 hover:text-accent"></div>
</a>
</div>
</div>
</div>
<div className='py-12 flex flex-col justify-center items-center'>
<Link href='/'>
<a className='flex items-center'>
<span className='text-accent text-2xl font-semibold px-1 pb-2'>
<div className="py-12 flex flex-col justify-center items-center">
<Link href="/">
<a className="flex items-center">
<span className="text-accent text-2xl font-semibold px-1 pb-2">
Unkn
</span>
</a>
</Link>
<p className='mt-3 text-xs lg:text-sm leading-none text-gray-500'>
<p className="mt-3 text-xs lg:text-sm leading-none text-gray-500">
2021 UnknLists. All Rights Reserved.
</p>
</div>
</footer>
);
};
export default Footer;
)
}
export default Footer
1 change: 1 addition & 0 deletions components/Layout/Public/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const ItemList = ({
<Item link={'/kvittering'} text={'Kvitteringer'} />
<Item link={'/faktura'} text={'Faktura'} />
<Item link={'/faq'} text={'FAQ'} />
<Item link={'/profile'} text={'Profil'} />
{status == 'authenticated' && session.user.role != 'USER' ? (
<Item link={'/admin'} text={'Dashboard'} />
) : (
Expand Down
2 changes: 1 addition & 1 deletion components/html/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Button = ({ logo = false, className, ...props }: Props) => {
return (
<button
{...props}
className={`${className} bg-online-blue-500 text-zinc-100 px-4 py-px rounded shadow-md cursor-pointer`}
className={`${className} bg-online-blue-500 text-zinc-100 my-2 px-4 py-px rounded shadow-md cursor-pointer`}
/>
)
}
Expand Down
1 change: 1 addition & 0 deletions images/undraw/stonks.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 37 additions & 36 deletions lib/auth/OnlineProvider.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
import { Session } from 'next-auth';
import type { OAuthConfig, OAuthUserConfig } from 'next-auth/providers/oauth';
import { type } from 'os';
import { Session } from 'next-auth'
import type { OAuthConfig, OAuthUserConfig } from 'next-auth/providers/oauth'
import { type } from 'os'

export const OW4_ADDRESS = process.env.OW4_ADDRESS || 'https://online.ntnu.no';
export const OW4_ADDRESS = process.env.OW4_ADDRESS || 'https://online.ntnu.no'

export type Token = {
name?: string;
email?: string;
picture?: string; // url to image
accessToken?: string;
iat: number;
exp: number;
};
name?: string
email?: string
picture?: string // url to image
accessToken?: string
iat: number
exp: number
}

export type Account = {
provider: string | null;
type: string | null;
id: number | null;
refreshToken: string | null;
accessToken: string | null;
accessTokenExpires: null;
};
provider: string | null
type: string | null
id: number | null
refreshToken: string | null
accessToken: string | null
accessTokenExpires: null
}

export interface Profile {
sub: number;
name: string;
given_name: string;
family_name: string;
nickname: string;
preferred_username: string;
picture: string;
sub: number
name: string
given_name: string
family_name: string
nickname: string
preferred_username: string
picture: string
}

interface IOnlinewebScope {
field_of_study: string;
member: boolean;
rfid: string | null;
staff: boolean;
superuser: boolean;
field_of_study: string
member: boolean
rfid: string | null
staff: boolean
superuser: boolean
}

interface IEmailScope {
email: string;
email_verified: boolean;
email: string
email_verified: boolean
}

/**
Expand All @@ -51,9 +51,9 @@ interface IEmailScope {
*/
export type IAuthProfile = NonNullable<Profile> &
IOnlinewebScope &
Partial<IEmailScope>;
Partial<IEmailScope>

export type OnlineSession = Session & {};
export type OnlineSession = Session & {}

// authorization (replaces authorizationUrl, authorizationParams, scope)
// token replaces (accessTokenUrl, headers, params)
Expand All @@ -78,14 +78,15 @@ export default function OnlineProvider<P extends IAuthProfile & { id: string }>(
'https://old.online.ntnu.no/openid/.well-known/openid-configuration',
idToken: true,
checks: ['state'],
profile: (profile: IAuthProfile) => {
/*profile: (profile: IAuthProfile) => {
return {
...profile,
id: '' + profile.sub,
image: profile.picture,
email: profile.email,
};
},
*/
options,
};
}
}
Loading