complete user class

This commit is contained in:
2026-06-29 21:17:57 +03:30
parent fc297103fa
commit 735139f4a4
2 changed files with 22 additions and 9 deletions
@@ -1,6 +1,7 @@
package dev.database;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DatabaseConnection {
@@ -18,10 +19,7 @@ public class DatabaseConnection {
public static Connection getConnection()
throws SQLException {
// TODO:
// Return a valid PostgreSQL connection
return null;
return DriverManager.getConnection(URL, USER, PASSWORD);
}
}
+20 -5
View File
@@ -1,13 +1,28 @@
package dev.model;
public class User {
private int id;
private String username;
private String password;
private String password; // holds the hash when loaded from DB
private String email;
public User() {}
public User(String username, String password, String email) {
this.username = username;
this.password = password;
this.email = email;
}
public int getId(){ return id; }
public void setId(int id) { this.id = id; }
public String getUsername(){ return username; }
public void setUsername(String u){ this.username = u; }
public String getPassword() { return password; }
public void setPassword(String p){ this.password = p; }
public String getEmail(){ return email; }
public void setEmail(String e){ this.email = e; }
}