complete user class
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
Reference in New Issue
Block a user