@main12/auth-login 0.2.3 → 0.3.0

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.
@@ -18,5 +18,7 @@ export interface AuthPagesProps {
18
18
  }) => Promise<void>;
19
19
  /** Base path prefix, defaults to '/auth'. Used to compute sibling URLs. */
20
20
  basePath?: string;
21
+ /** Show Google OAuth buttons. If omitted, reads from plugin config. */
22
+ showGoogleOAuth?: boolean;
21
23
  }
22
- export default function AuthPages({ slug, redirectTo, logo, onPasswordLogin, onSignup, basePath, }: AuthPagesProps): import("react/jsx-runtime").JSX.Element;
24
+ export default function AuthPages({ slug, redirectTo, logo, onPasswordLogin, onSignup, basePath, showGoogleOAuth, }: AuthPagesProps): import("react/jsx-runtime").JSX.Element;
@@ -37,11 +37,14 @@ const defaultSignup = async ({ name, email })=>{
37
37
  throw new Error(err.message || 'Signup failed');
38
38
  }
39
39
  };
40
- export default function AuthPages({ slug, redirectTo = '/admin', logo, onPasswordLogin = defaultPasswordLogin, onSignup = defaultSignup, basePath = '/auth' }) {
40
+ export default function AuthPages({ slug, redirectTo = '/admin', logo, onPasswordLogin = defaultPasswordLogin, onSignup = defaultSignup, basePath = '/auth', showGoogleOAuth }) {
41
41
  const page = slug?.[0] ?? 'login';
42
42
  const base = basePath.replace(/\/$/, '');
43
43
  const shared = {
44
- logo
44
+ logo,
45
+ ...showGoogleOAuth !== undefined ? {
46
+ showGoogleOAuth
47
+ } : {}
45
48
  };
46
49
  switch(page){
47
50
  case 'login':
package/dist/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export const pluginConfig = {
2
2
  style: 'tailwind',
3
- googleOAuthEnabled: true,
3
+ googleOAuthEnabled: false,
4
4
  routeRedirects: false,
5
5
  authBasePath: '/auth'
6
6
  };
package/dist/proxy.js CHANGED
@@ -34,6 +34,12 @@ const AUTH_ROUTES = [
34
34
  return NextResponse.next();
35
35
  }
36
36
  const { pathname } = request.nextUrl;
37
+ // Always redirect /admin/login to the plugin login page
38
+ if (pathname === '/admin/login' || pathname === '/admin/login/') {
39
+ const url = request.nextUrl.clone();
40
+ url.pathname = `${base}/login`;
41
+ return NextResponse.redirect(url);
42
+ }
37
43
  const segment = pathname.replace(/^\//, '').replace(/\/$/, '');
38
44
  if (routeSet.has(segment) && !pathname.startsWith(`${base}/`)) {
39
45
  const url = request.nextUrl.clone();
@@ -46,6 +52,7 @@ const AUTH_ROUTES = [
46
52
  export const proxy = createAuthProxy();
47
53
  export const config = {
48
54
  matcher: [
55
+ '/admin/login',
49
56
  '/login',
50
57
  '/signup',
51
58
  '/forgot-password',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@main12/auth-login",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Reusable Payload CMS auth plugin — login, signup, OTP, forgot password, branded emails, Powered by Main12",
5
5
  "license": "MIT",
6
6
  "type": "module",