mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-24 08:32:34 +02:00
Merge pull request #536 from OpenSignLabs/doc_load_drive
refactor: remove protected fields migration
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import crypto from 'node:crypto';
|
||||
export default async function loginUser(request) {
|
||||
const username = request.params.email;
|
||||
const password = request.params.password;
|
||||
|
||||
if (username && password) {
|
||||
try {
|
||||
// Pass the username and password to logIn function
|
||||
const user = await Parse.User.logIn(username, password);
|
||||
// console.log('user ', user);
|
||||
if (user) {
|
||||
const _user = user?.toJSON();
|
||||
return {
|
||||
..._user,
|
||||
};
|
||||
} else {
|
||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'user not found.');
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('err in login user', err);
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
throw new Parse.Error(Parse.Error.PASSWORD_MISSING, 'username/password is missing.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user