uibee 1.6.4 → 1.6.6
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.
- package/dist/src/components/login/loginPage.d.ts +1 -1
- package/dist/src/components/login/loginPage.js +2 -2
- package/dist/src/utils/auth/callback.d.ts +1 -1
- package/dist/src/utils/auth/callback.js +2 -2
- package/dist/src/utils/auth/login.d.ts +1 -1
- package/dist/src/utils/auth/login.js +2 -2
- package/package.json +1 -1
- package/src/components/login/loginPage.tsx +2 -2
- package/src/types/components.d.ts +1 -1
- package/src/types/utils.d.ts +2 -2
- package/src/utils/auth/callback.ts +2 -2
- package/src/utils/auth/login.ts +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LoginPageProps } from 'uibee/components';
|
|
2
|
-
export default function LoginPage({ title, description,
|
|
2
|
+
export default function LoginPage({ title, description, redirectURL, version, btg, handleSubmit }: LoginPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,12 +3,12 @@ import { LogIn } from 'lucide-react';
|
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import logo from '../../../images/logo-tekst-white.svg';
|
|
6
|
-
export default function LoginPage({ title, description,
|
|
6
|
+
export default function LoginPage({ title, description, redirectURL, version, btg, handleSubmit }) {
|
|
7
7
|
return (_jsx("main", { className: 'min-h-screen flex items-center justify-center bg-login-900 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(Image, { src: logo, alt: 'Logo', fill: true, className: 'object-contain 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-login-100 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 => {
|
|
8
8
|
e.preventDefault();
|
|
9
9
|
handleSubmit?.(new FormData(e.currentTarget));
|
|
10
10
|
e.currentTarget.reset();
|
|
11
11
|
}, children: [_jsx("input", { type: 'text', name: 'name', placeholder: 'Name', className: 'py-2 px-3 rounded bg-login-900 text-login-50 font-medium focus:outline-none', required: true }), _jsx("input", { type: 'password', name: 'token', placeholder: 'Token', className: 'py-2 px-3 rounded bg-login-900 text-login-50 font-medium focus:outline-none', required: true }), _jsx("button", { type: 'submit', className: 'py-2 px-4 rounded-xl bg-login font-bold text-lg ' +
|
|
12
|
-
'hover:bg-login/80 text-login-50 transition-all duration-200 mt-2', children: "Login" })] })) : (_jsx(Link, { href:
|
|
12
|
+
'hover:bg-login/80 text-login-50 transition-all duration-200 mt-2', children: "Login" })] })) : (_jsx(Link, { href: redirectURL, className: 'w-full flex justify-center', 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 ' +
|
|
13
13
|
'hover:bg-login/80 text-login-50 transition-all duration-200 mb-2 mt-2', children: ["Login", _jsx(LogIn, { className: 'w-6 h-6' })] }) })), _jsxs("span", { className: 'text-login-100 text-sm mt-2', children: ["v", version] })] }) }));
|
|
14
14
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AuthCallbackProps } from 'uibee/utils';
|
|
2
|
-
export default function authCallback({ req, tokenURL, clientID, clientSecret,
|
|
2
|
+
export default function authCallback({ req, tokenURL, clientID, clientSecret, redirectURL, userInfoURL, tokenRedirectURL }: AuthCallbackProps): Promise<Response>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
export default async function authCallback({ req, tokenURL, clientID, clientSecret,
|
|
2
|
+
export default async function authCallback({ req, tokenURL, clientID, clientSecret, redirectURL, userInfoURL, tokenRedirectURL }) {
|
|
3
3
|
const searchParams = new URL(req.url).searchParams;
|
|
4
4
|
if (!searchParams) {
|
|
5
5
|
return NextResponse.json({ error: 'No search parameters found.' }, { status: 400 });
|
|
@@ -17,7 +17,7 @@ export default async function authCallback({ req, tokenURL, clientID, clientSecr
|
|
|
17
17
|
client_id: clientID,
|
|
18
18
|
client_secret: clientSecret,
|
|
19
19
|
code: code,
|
|
20
|
-
|
|
20
|
+
redirect_url: redirectURL,
|
|
21
21
|
grant_type: 'authorization_code',
|
|
22
22
|
}).toString()
|
|
23
23
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
2
|
import type { AuthLoginProps } from 'uibee/utils';
|
|
3
|
-
export default function AuthLogin({ clientID,
|
|
3
|
+
export default function AuthLogin({ clientID, redirectURL, authURL }: AuthLoginProps): Promise<NextResponse<unknown>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
export default async function AuthLogin({ clientID,
|
|
2
|
+
export default async function AuthLogin({ clientID, redirectURL, authURL }) {
|
|
3
3
|
const state = Math.random().toString(36).substring(5);
|
|
4
4
|
const authQueryParams = new URLSearchParams({
|
|
5
5
|
client_id: clientID,
|
|
6
|
-
|
|
6
|
+
redirect_url: redirectURL,
|
|
7
7
|
response_type: 'code',
|
|
8
8
|
scope: 'openid profile email',
|
|
9
9
|
state: state,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import Link from 'next/link'
|
|
|
4
4
|
import Image from 'next/image'
|
|
5
5
|
import logo from '@images/logo-tekst-white.svg'
|
|
6
6
|
|
|
7
|
-
export default function LoginPage({title, description,
|
|
7
|
+
export default function LoginPage({title, description, redirectURL, version, btg, handleSubmit}: LoginPageProps) {
|
|
8
8
|
return (
|
|
9
9
|
<main className='min-h-screen flex items-center justify-center bg-login-900 p-8'>
|
|
10
10
|
<div
|
|
@@ -62,7 +62,7 @@ export default function LoginPage({title, description, redirectURI, version, btg
|
|
|
62
62
|
</button>
|
|
63
63
|
</form>
|
|
64
64
|
) : (
|
|
65
|
-
<Link href={
|
|
65
|
+
<Link href={redirectURL} className='w-full flex justify-center'>
|
|
66
66
|
<button
|
|
67
67
|
className={
|
|
68
68
|
'flex items-center justify-center gap-2 w-full max-w-xs py-3 px-6 rounded-xl bg-login font-bold text-lg ' +
|
package/src/types/utils.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare module 'uibee/utils' {
|
|
|
33
33
|
|
|
34
34
|
export interface AuthLoginProps {
|
|
35
35
|
clientID: string
|
|
36
|
-
|
|
36
|
+
redirectURL: string
|
|
37
37
|
authURL: string
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -42,7 +42,7 @@ declare module 'uibee/utils' {
|
|
|
42
42
|
tokenURL: string
|
|
43
43
|
clientID: string
|
|
44
44
|
clientSecret: string
|
|
45
|
-
|
|
45
|
+
redirectURL: string
|
|
46
46
|
userInfoURL: string
|
|
47
47
|
tokenRedirectURL: string
|
|
48
48
|
}
|
|
@@ -13,7 +13,7 @@ export default async function authCallback({
|
|
|
13
13
|
tokenURL,
|
|
14
14
|
clientID,
|
|
15
15
|
clientSecret,
|
|
16
|
-
|
|
16
|
+
redirectURL,
|
|
17
17
|
userInfoURL,
|
|
18
18
|
tokenRedirectURL
|
|
19
19
|
}: AuthCallbackProps) {
|
|
@@ -37,7 +37,7 @@ export default async function authCallback({
|
|
|
37
37
|
client_id: clientID,
|
|
38
38
|
client_secret: clientSecret,
|
|
39
39
|
code: code as string,
|
|
40
|
-
|
|
40
|
+
redirect_url: redirectURL,
|
|
41
41
|
grant_type: 'authorization_code',
|
|
42
42
|
}).toString()
|
|
43
43
|
})
|
package/src/utils/auth/login.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server'
|
|
2
2
|
import type { AuthLoginProps } from 'uibee/utils'
|
|
3
3
|
|
|
4
|
-
export default async function AuthLogin({ clientID,
|
|
4
|
+
export default async function AuthLogin({ clientID, redirectURL, authURL }: AuthLoginProps) {
|
|
5
5
|
const state = Math.random().toString(36).substring(5)
|
|
6
6
|
const authQueryParams = new URLSearchParams({
|
|
7
7
|
client_id: clientID,
|
|
8
|
-
|
|
8
|
+
redirect_url: redirectURL,
|
|
9
9
|
response_type: 'code',
|
|
10
10
|
scope: 'openid profile email',
|
|
11
11
|
state: state,
|