mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-04 04:23:16 +00:00
feat: add more security settings
This commit is contained in:
@ -26,6 +26,22 @@ const WorkspaceSecuritySection = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const toggleDisallowPasswordAuth = async (on: boolean) => {
|
||||
if (on) {
|
||||
const confirmed = window.confirm("Are you sure to disallow password auth? This will prevent users from signing in with password.");
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await updateWorkspaceSetting(
|
||||
WorkspaceSetting.fromPartial({
|
||||
disallowPasswordAuth: on,
|
||||
}),
|
||||
["disallow_password_auth"],
|
||||
);
|
||||
};
|
||||
|
||||
const updateWorkspaceSetting = async (workspaceSetting: WorkspaceSetting, updateMask: string[]) => {
|
||||
if (updateMask.length === 0) {
|
||||
toast.error("No changes made");
|
||||
@ -58,6 +74,15 @@ const WorkspaceSecuritySection = () => {
|
||||
endDecorator={<span>{t("settings.workspace.disallow-user-registration.self")}</span>}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
className="dark:text-gray-500"
|
||||
size="lg"
|
||||
checked={workspaceStore.setting.disallowPasswordAuth}
|
||||
onChange={(event) => toggleDisallowPasswordAuth(event.target.checked)}
|
||||
endDecorator={<span>{"Disallow password auth"}</span>}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -117,7 +117,7 @@ const SignIn: React.FC = () => {
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
{workspaceStore.profile.enableSignup && (
|
||||
{!workspaceStore.setting.disallowUserRegistration && (
|
||||
<p className="w-full mt-4 text-sm">
|
||||
<span className="dark:text-gray-500">{"Don't have an account yet?"}</span>
|
||||
<Link className="cursor-pointer ml-2 text-blue-600 hover:underline" to="/auth/signup" unstable_viewTransition>
|
||||
|
@ -21,7 +21,7 @@ const SignUp: React.FC = () => {
|
||||
const allowConfirm = email.length > 0 && nickname.length > 0 && password.length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (!workspaceStore.profile.enableSignup) {
|
||||
if (workspaceStore.setting.disallowUserRegistration) {
|
||||
return navigateTo("/auth", {
|
||||
replace: true,
|
||||
});
|
||||
|
@ -162,11 +162,11 @@ const SubscriptionSetting: React.FC = () => {
|
||||
</li>
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.CheckCircle2 className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
Advanced analytics
|
||||
High-priority in roadmap
|
||||
</li>
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.CheckCircle2 className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
High-priority in roadmap
|
||||
Email support
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -190,16 +190,20 @@ const SubscriptionSetting: React.FC = () => {
|
||||
<p className="mt-2 font-medium dark:text-gray-300">Everything in Pro, and</p>
|
||||
<ul className="mt-4 space-y-3">
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.Building2 className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
<Icon.BadgeCheck className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
Custom branding
|
||||
</li>
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.BarChart3 className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
Advanced analytics
|
||||
</li>
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.Shield className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
Single Sign-On(SSO)
|
||||
</li>
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.Mail className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
Email support
|
||||
<Icon.Building2 className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
Priority support
|
||||
</li>
|
||||
<li className="flex items-center dark:text-gray-300">
|
||||
<Icon.Sparkles className="w-5 h-auto text-green-600 mr-1 shrink-0" />
|
||||
|
Reference in New Issue
Block a user