uibee 2.4.2 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LogIn } from 'lucide-react';
3
- import Link from 'next/link';
4
3
  import Logo from '../logo/logo';
4
+ import Link from 'next/link';
5
5
  export default function LoginPage({ title, description, redirectURL, version, btg, handleSubmit }) {
6
- return (_jsx("main", { className: 'w-full h-full flex items-center justify-center bg-login-800 p-8', children: _jsxs("div", { className: 'flex flex-col justify-center items-center bg-login-600 px-4 py-12 rounded-xl w-full max-w-md gap-4 md:gap-6', children: [_jsx("div", { className: 'relative aspect-[3/1] w-full', children: _jsx(Logo, { className: 'object-contain px-6 sm:px-12' }) }), _jsxs("h1", { className: 'text-3xl font-extrabold text-login text-center tracking-tight', children: [title, " ", btg ? ' - Break the Glass' : ''] }), description && (_jsx("p", { className: 'text-center font-medium text-lg mb-2 max-w-xs', children: description })), btg ? (_jsxs("form", { className: 'w-full flex flex-col gap-3 max-w-xs', onSubmit: e => {
6
+ return (_jsx("main", { className: 'w-full h-full flex items-center justify-center bg-login-800 p-8', children: _jsxs("div", { className: 'flex flex-col justify-center items-center bg-login-600 px-4 py-12 rounded-xl w-full max-w-md gap-4 md:gap-6', children: [_jsx("div", { className: 'relative aspect-3/1 w-full', children: _jsx(Logo, { className: 'object-contain px-6 sm:px-12' }) }), _jsxs("h1", { className: 'text-3xl font-extrabold text-login text-center tracking-tight', children: [title, " ", btg ? ' - Break the Glass' : ''] }), description && (_jsx("p", { className: 'text-center font-medium text-lg mb-2 max-w-xs', children: description })), btg ? (_jsxs("form", { className: 'w-full flex flex-col gap-3 max-w-xs', onSubmit: e => {
7
7
  e.preventDefault();
8
8
  handleSubmit?.(new FormData(e.currentTarget));
9
9
  e.currentTarget.reset();
10
10
  }, children: [_jsx("input", { type: 'text', name: 'name', placeholder: 'Name', className: 'py-2 px-3 rounded bg-login-900 font-medium focus:outline-none', required: true }), _jsx("input", { type: 'password', name: 'token', placeholder: 'Token', className: 'py-2 px-3 rounded bg-login-900 font-medium focus:outline-none', required: true }), _jsx("button", { type: 'submit', className: 'py-2 px-4 rounded-xl bg-login font-bold text-lg ' +
11
- 'hover:bg-login/80 transition-all duration-200 mt-2', children: "Login" })] })) : (_jsx(Link, { href: redirectURL, className: 'w-full flex justify-center cursor-default', children: _jsxs("button", { className: 'flex items-center justify-center gap-2 w-full max-w-xs py-3 px-6 rounded-xl bg-login font-bold text-lg ' +
12
- 'hover:bg-login/80 transition-all duration-200 mb-2 mt-2 cursor-pointer', children: ["Login", _jsx(LogIn, { className: 'w-6 h-6' })] }) })), _jsxs("span", { className: 'text-sm mt-2', children: ["v", version] })] }) }));
11
+ 'hover:bg-login/80 transition-all duration-200 mt-2', children: "Login" })] })) : (_jsxs(Link, { href: redirectURL, className: `
12
+ flex items-center justify-center gap-2 w-full
13
+ max-w-xs py-3 px-6 rounded-xl bg-login font-bold
14
+ text-lg hover:bg-login/80 transition-all
15
+ duration-200 mb-2 mt-2 cursor-pointer
16
+ `, children: ["Login", _jsx(LogIn, { className: 'w-6 h-6' })] })), _jsxs("span", { className: 'text-sm mt-2', children: ["v", version] })] }) }));
13
17
  }
@@ -417,7 +417,7 @@
417
417
  .hidden {
418
418
  display: none;
419
419
  }
420
- .aspect-\[3\/1\] {
420
+ .aspect-3\/1 {
421
421
  aspect-ratio: 3/1;
422
422
  }
423
423
  .h-0 {
@@ -606,9 +606,6 @@
606
606
  .animate-jump {
607
607
  animation: jump 0.4s 1;
608
608
  }
609
- .cursor-default {
610
- cursor: default;
611
- }
612
609
  .cursor-pointer {
613
610
  cursor: pointer;
614
611
  }
@@ -1,3 +1,3 @@
1
1
  import { NextResponse } from 'next/server';
2
2
  import type { AuthLogoutProps } from 'uibee/utils';
3
- export default function AuthLogout({ frontendURL }: AuthLogoutProps): Promise<NextResponse<unknown>>;
3
+ export default function AuthLogout({ frontendURL, path }: AuthLogoutProps): Promise<NextResponse<unknown>>;
@@ -1,17 +1,7 @@
1
+ import { removeCookies } from '../cookies/cookies';
1
2
  import { NextResponse } from 'next/server';
2
- export default async function AuthLogout({ frontendURL }) {
3
- const response = NextResponse.redirect(new URL('/', frontendURL));
4
- // Remove all authentication cookies
5
- const cookiesToRemove = [
6
- 'access_token',
7
- 'user_id',
8
- 'user_name',
9
- 'user_nickname',
10
- 'user_email',
11
- 'user_groups'
12
- ];
13
- cookiesToRemove.forEach(cookieName => {
14
- response.cookies.delete(cookieName);
15
- });
3
+ export default async function AuthLogout({ frontendURL, path }) {
4
+ removeCookies('access_token', 'user_id', 'user_name', 'user_nickname', 'user_email', 'user_groups');
5
+ const response = NextResponse.redirect(new URL(path || '/', frontendURL));
16
6
  return response;
17
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uibee",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "description": "Shared components, functions and hooks for reuse across Login projects",
5
5
  "homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
6
6
  "bugs": {
@@ -54,6 +54,7 @@ declare module 'uibee/utils' {
54
54
  }
55
55
  export interface AuthLogoutProps {
56
56
  request: NextRequest
57
+ path?: string
57
58
  frontendURL: string
58
59
  }
59
60
 
@@ -1,17 +1,21 @@
1
- import { removeCookies } from '@utils/cookies/cookies'
2
1
  import { NextResponse } from 'next/server'
3
2
  import type { AuthLogoutProps } from 'uibee/utils'
4
3
 
5
- export default async function AuthLogout({ frontendURL }: AuthLogoutProps) {
6
- removeCookies(
4
+ export default async function AuthLogout({ frontendURL, path }: AuthLogoutProps) {
5
+ const response = NextResponse.redirect(new URL(path || '/', frontendURL))
6
+
7
+ const cookiesToRemove = [
7
8
  'access_token',
8
9
  'user_id',
9
10
  'user_name',
10
11
  'user_nickname',
11
12
  'user_email',
12
13
  'user_groups'
13
- )
14
+ ]
15
+
16
+ cookiesToRemove.forEach(cookieName => {
17
+ response.cookies.delete(cookieName)
18
+ })
14
19
 
15
- const response = NextResponse.redirect(new URL('/', frontendURL))
16
20
  return response
17
21
  }