mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-14 18:40:11 +01:00
Fix multi-user setup bug for invalid username/password (#2130)
* fix multiuser setup bug for invalid username/password * handle user creation failed gracefully and delete user on fail
This commit is contained in:
parent
ff0605ce67
commit
1dad4d9409
@ -288,6 +288,11 @@ const MyTeam = ({ setMultiUserLoginValid, myTeamSubmitRef, navigate }) => {
|
|||||||
onChange={handleUsernameChange}
|
onChange={handleUsernameChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<p className=" text-white text-opacity-80 text-xs font-base">
|
||||||
|
Username must be at least 6 characters long and only contain
|
||||||
|
lowercase letters, numbers, underscores, and hyphens with no
|
||||||
|
spaces.
|
||||||
|
</p>
|
||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<label
|
<label
|
||||||
htmlFor="name"
|
htmlFor="name"
|
||||||
@ -306,9 +311,8 @@ const MyTeam = ({ setMultiUserLoginValid, myTeamSubmitRef, navigate }) => {
|
|||||||
onChange={handlePasswordChange}
|
onChange={handlePasswordChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p className="w-96 text-white text-opacity-80 text-xs font-base">
|
<p className=" text-white text-opacity-80 text-xs font-base">
|
||||||
Username must be at least 6 characters long. Password must be at
|
Password must be at least 8 characters long.
|
||||||
least 8 characters long.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -481,6 +481,15 @@ function systemEndpoints(app) {
|
|||||||
password,
|
password,
|
||||||
role: ROLES.admin,
|
role: ROLES.admin,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (error || !user) {
|
||||||
|
response.status(400).json({
|
||||||
|
success: false,
|
||||||
|
error: error || "Failed to enable multi-user mode.",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await SystemSettings._updateSettings({
|
await SystemSettings._updateSettings({
|
||||||
multi_user_mode: true,
|
multi_user_mode: true,
|
||||||
limit_user_messages: false,
|
limit_user_messages: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user