mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
fix(config/scripts): Enhance User Creation and Ban Handling, Standardize Imports (#1144)
* chore: use relative imports for scripts * fix(create-user): newUser.save() now properly awaited, double-check user creation, use relative imports, catch exception * fix(ban-user): catch exception, handle case where IP is undefined, proper check of user ban on login
This commit is contained in:
parent
a2ee57568a
commit
5f3ecef575
7 changed files with 102 additions and 27 deletions
|
|
@ -91,7 +91,7 @@ const registerUser = async (user) => {
|
|||
const salt = bcrypt.genSaltSync(10);
|
||||
const hash = bcrypt.hashSync(newUser.password, salt);
|
||||
newUser.password = hash;
|
||||
newUser.save();
|
||||
await newUser.save();
|
||||
|
||||
return { status: 200, user: newUser };
|
||||
} catch (err) {
|
||||
|
|
@ -117,7 +117,7 @@ const requestPasswordReset = async (email) => {
|
|||
}
|
||||
|
||||
let resetToken = crypto.randomBytes(32).toString('hex');
|
||||
const hash = await bcrypt.hashSync(resetToken, 10);
|
||||
const hash = bcrypt.hashSync(resetToken, 10);
|
||||
|
||||
await new Token({
|
||||
userId: user._id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue