fix: #546 issue with closing registration (#547)

* fix: #546 issue with closing registration

* refactor: change casing of controller files for consistency

* fix: ensure registrationEnabled is sending a boolean value

* refactor: modifications to openId code
This commit is contained in:
Dan Orlando 2023-06-25 12:40:31 -07:00 committed by GitHub
parent fdc5265f48
commit 25211d6f23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 44356 additions and 44376 deletions

View file

@ -15,7 +15,6 @@ function Login() {
navigate('/chat/new');
}
}, [isAuthenticated, navigate]);
return (
<div className="flex min-h-screen flex-col items-center justify-center bg-white pt-6 sm:pt-0">
<div className="mt-6 w-96 overflow-hidden bg-white px-6 py-4 sm:max-w-md sm:rounded-lg">
@ -80,30 +79,25 @@ function Login() {
)}
{startupConfig?.openidLoginEnabled && (
<>
<div className="relative mt-6 flex w-full items-center justify-center border border-t uppercase">
<div className="absolute bg-white px-3 text-xs">Or</div>
</div>
<div className="mt-4 flex gap-x-2">
<a
aria-label="Login with OpenID"
className="justify-left flex w-full items-center space-x-3 rounded-md border border-gray-300 px-5 py-3 hover:bg-gray-50 focus:ring-2 focus:ring-violet-600 focus:ring-offset-1"
href={`${startupConfig.serverDomain}/oauth/openid`}
>
{startupConfig.openidUrl ? (
<img src={startupConfig.openidUrl} alt="OpenID Logo" className="h-5 w-5"/>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
id="openid"
className="h-5 w-5"
>
<path
d="M271.5 432l-68 32C88.5 453.7 0 392.5 0 318.2c0-71.5 82.5-131 191.7-144.3v43c-71.5 12.5-124 53-124 101.3 0 51 58.5 93.3 135.7 103v-340l68-33.2v384zM448 291l-131.3-28.5 36.8-20.7c-19.5-11.5-43.5-20-70-24.8v-43c46.2 5.5 87.7 19.5 120.3 39.3l35-19.8L448 291z"
></path>
</svg>
)}
<p>{startupConfig.openidLabel}</p>
{startupConfig.openidImageUrl ? (
<img src={startupConfig.openidImageUrl} alt="OpenID Logo" className="h-5 w-5" />
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
id="openid"
className="h-5 w-5"
>
<path d="M271.5 432l-68 32C88.5 453.7 0 392.5 0 318.2c0-71.5 82.5-131 191.7-144.3v43c-71.5 12.5-124 53-124 101.3 0 51 58.5 93.3 135.7 103v-340l68-33.2v384zM448 291l-131.3-28.5 36.8-20.7c-19.5-11.5-43.5-20-70-24.8v-43c46.2 5.5 87.7 19.5 120.3 39.3l35-19.8L448 291z"></path>
</svg>
)}
<p>{startupConfig.openidLabel}</p>
</a>
</div>
</>

View file

@ -323,21 +323,19 @@ function Registration() {
className="justify-left flex w-full items-center space-x-3 rounded-md border border-gray-300 px-5 py-3 hover:bg-gray-50 focus:ring-2 focus:ring-violet-600 focus:ring-offset-1"
href={`${startupConfig.serverDomain}/oauth/openid`}
>
{startupConfig.openidUrl ? (
<img src={startupConfig.openidUrl} alt="OpenID Logo" className="h-5 w-5"/>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
id="openid"
className="h-5 w-5"
>
<path
d="M271.5 432l-68 32C88.5 453.7 0 392.5 0 318.2c0-71.5 82.5-131 191.7-144.3v43c-71.5 12.5-124 53-124 101.3 0 51 58.5 93.3 135.7 103v-340l68-33.2v384zM448 291l-131.3-28.5 36.8-20.7c-19.5-11.5-43.5-20-70-24.8v-43c46.2 5.5 87.7 19.5 120.3 39.3l35-19.8L448 291z"
></path>
</svg>
)}
<p>{startupConfig.openidLabel}</p>
{startupConfig.openidImageUrl ? (
<img src={startupConfig.openidImageUrl} alt="OpenID Logo" className="h-5 w-5" />
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
id="openid"
className="h-5 w-5"
>
<path d="M271.5 432l-68 32C88.5 453.7 0 392.5 0 318.2c0-71.5 82.5-131 191.7-144.3v43c-71.5 12.5-124 53-124 101.3 0 51 58.5 93.3 135.7 103v-340l68-33.2v384zM448 291l-131.3-28.5 36.8-20.7c-19.5-11.5-43.5-20-70-24.8v-43c46.2 5.5 87.7 19.5 120.3 39.3l35-19.8L448 291z"></path>
</svg>
)}
<p>{startupConfig.openidLabel}</p>
</a>
</div>
</>

View file

@ -25,7 +25,7 @@ const setup = ({
googleLoginEnabled: true,
openidLoginEnabled: true,
openidLabel: 'Test OpenID',
openidUrl: 'http://test-server.com',
openidImageUrl: 'http://test-server.com',
registrationEnabled: true,
serverDomain: 'mock-server'
}

View file

@ -25,7 +25,7 @@ const setup = ({
googleLoginEnabled: true,
openidLoginEnabled: true,
openidLabel: 'Test OpenID',
openidUrl: 'http://test-server.com',
openidImageUrl: 'http://test-server.com',
registrationEnabled: true,
serverDomain: 'mock-server'
}

View file

@ -239,7 +239,7 @@ export type TStartupConfig = {
googleLoginEnabled: boolean;
openidLoginEnabled: boolean;
openidLabel: string;
openidUrl: string;
openidImageUrl: string;
serverDomain: string;
registrationEnabled: boolean;
}