]> PHS Git Server - phs-api.git/commitdiff
Adding auth, media, and messaging.
authorcharleswrayjr <charleswrayjr@gmail.com>
Sat, 13 Sep 2025 14:08:51 +0000 (09:08 -0500)
committercharleswrayjr <charleswrayjr@gmail.com>
Sat, 13 Sep 2025 14:08:51 +0000 (09:08 -0500)
src/models/user.model.js

index 13e16fa75b4520278ac6134c41bb4ac12b9ecfdc..5e8390e6f3363d2ccbef504c3636fe8607db1c91 100644 (file)
@@ -46,8 +46,9 @@ class User extends Model {
     this.base_query = `
         SELECT u.id, u.email, u.first_name, u.middle_name, u.last_name, u.initials, u.nickname,
                u.created_by_id, u.created_at, u.is_deleted, u.deleted_by_id, u.deleted_at,
-               u.is_active, u.deactivated_by_id, u.deactivated_at
+               u.is_active, u.deactivated_by_id, u.deactivated_at, a.password, a.password_salt
         FROM phase.users u
+            inner join phase.authentication a on u.id = a.user_id
     `;
     this.base_list_query = `
         SELECT u.id, u.email, u.first_name, u.middle_name, u.last_name, u.initials, u.nickname,
@@ -145,12 +146,11 @@ class User extends Model {
     });
   }
 
-  async comparePassword(password, auth) {
-    logger.warn(auth);
+  async comparePassword(password) {
     logger.warn(password);
-    logger.warn(auth.password);
-    logger.warn(bcrypt.compareSync(password, auth.password));
-    return auth ? bcrypt.compareSync(password, auth.password) : false;
+    logger.warn(this.password);
+    logger.warn(bcrypt.compareSync(password, this.password));
+    return password ? bcrypt.compareSync(password, this.password) : false;
   }
 
   async createToken() {