Skip to content

Commit 3741fc0

Browse files
committed
stinky poos wont be locked out so easily now
1 parent 087e25e commit 3741fc0

1 file changed

Lines changed: 28 additions & 8 deletions

File tree

pages/index.tsx

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ const Home: NextPage = () => {
4949
const [loginBackground, setLoginBackground] = useState<string | null>(null)
5050
const [bgUploading, setBgUploading] = useState(false)
5151
const bgFileInputRef = useRef<HTMLInputElement>(null)
52+
const isOAuthConfigValid = (externalConfig.discordAppId.trim().length > 0 && externalConfig.discordAppSecret.trim().length > 0) || (externalConfig.clientId.trim().length > 0 && externalConfig.clientSecret.trim().length > 0 ) || (externalConfig.clientId.trim().length > 0 && externalConfig.clientSecret.trim().length > 0) || (externalConfig.google_id.trim().length > 0 && externalConfig.google_secret.trim().length > 0)
53+
5254

5355
const features = [
5456
{ title: "Workspaces", desc: "Each Roblox group gets its own workspace with members, roles, and activity tracking." },
@@ -321,6 +323,16 @@ const Home: NextPage = () => {
321323
setOnboardingSlide(onboardingSlide + 1)
322324
}
323325

326+
// workaround to prevent people from staying locked out of their instance
327+
useEffect(() => {
328+
if (!isOAuthConfigValid) {
329+
setExternalConfig(prev => ({
330+
...prev,
331+
oauthOnlyLogin: false
332+
}))
333+
}
334+
}, [isOAuthConfigValid])
335+
324336
return (
325337
<div>
326338
<Head>
@@ -862,19 +874,27 @@ const Home: NextPage = () => {
862874
<div className="mt-4 pt-4 border-t border-zinc-200 dark:border-zinc-700">
863875
<label className="flex items-center cursor-pointer">
864876
<input
865-
type="checkbox"
866-
checked={externalConfig.oauthOnlyLogin}
867-
onChange={(e) => setExternalConfig(prev => ({ ...prev, oauthOnlyLogin: e.target.checked }))}
868-
disabled={usingEnvVars}
869-
className={`w-4 h-4 text-blue-600 border-zinc-300 dark:border-zinc-600 rounded focus:ring-blue-500 focus:ring-2 ${usingEnvVars ? 'bg-zinc-100 dark:bg-zinc-800 cursor-not-allowed' : 'bg-white dark:bg-zinc-700'
870-
}`}
871-
/>
877+
type="checkbox"
878+
checked={externalConfig.oauthOnlyLogin}
879+
onChange={(e) =>
880+
setExternalConfig(prev => ({
881+
...prev,
882+
oauthOnlyLogin: e.target.checked
883+
}))
884+
}
885+
disabled={usingEnvVars || !isOAuthConfigValid}
886+
className={`w-4 h-4 text-blue-600 border-zinc-300 dark:border-zinc-600 rounded focus:ring-blue-500 focus:ring-2 ${
887+
usingEnvVars || !isOAuthConfigValid
888+
? 'bg-zinc-100 dark:bg-zinc-800 cursor-not-allowed'
889+
: 'bg-white dark:bg-zinc-700'
890+
}`}
891+
/>
872892
<span className={`ml-2 text-sm ${usingEnvVars ? 'text-zinc-500 dark:text-zinc-400' : 'text-zinc-700 dark:text-zinc-300'}`}>
873893
Enforce OAuth login
874894
</span>
875895
</label>
876896
<p className="text-xs text-zinc-500 dark:text-zinc-400 mt-1 ml-6">
877-
When enabled, users will only see the Roblox OAuth login button.
897+
When enabled, users will only see the OAuth login options.
878898
</p>
879899
</div>
880900
</div>

0 commit comments

Comments
 (0)