Skip to content
Snippets Groups Projects
Commit 525738d5 authored by Maximilian Komp's avatar Maximilian Komp
Browse files

Merge branch 'master' of https://git.fslab.de/tpinza2s/s4s

parents 78d974f1 0942d0a1
No related branches found
No related tags found
No related merge requests found
......@@ -104,9 +104,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.0.0</version>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>LATEST</version>
</dependency>
......
......@@ -21,6 +21,7 @@ import org.s4s.gui.views.ShopView;
import org.s4s.gui.views.VerkaeuferbewertungView;
import org.s4s.gui.views.WelcomeView;
import org.s4s.gui.views.WarenkorbView;
import org.s4s.services.db.JDBCConnection;
import org.s4s.services.util.Views;
/**
......@@ -50,6 +51,7 @@ public class InitView extends UI {
navi.addView(Views.KAUFBESTAETIGUNG, KaufbestaetigungView.class);
navi.addView(Views.VERKAEUFERBEWERTUNG, VerkaeuferbewertungView.class);
UI.getCurrent().getNavigator().navigateTo(Views.WELCOME);
}
......
......@@ -6,10 +6,12 @@
package org.s4s.dao.impl;
import java.sql.*;
import javax.swing.JOptionPane;
import org.s4s.dao.DAOException;
import org.s4s.dao.KundenDAO;
import org.s4s.dao.NoSuchUserOrPassword;
import org.s4s.modell.objects.dto.User;
import org.s4s.services.db.JDBCConnection;
/**
*
......@@ -17,21 +19,33 @@ import org.s4s.modell.objects.dto.User;
*/
public class LoginControl extends AbstractDatabaseClass implements KundenDAO {
public static void infoBox(String infoMessage, String titleBar)
{
JOptionPane.showMessageDialog(null, infoMessage, "InfoBox: " + titleBar, JOptionPane.INFORMATION_MESSAGE);
}
@Override
public User getUserByCredentials(String username, String password) throws NoSuchUserOrPassword, DAOException {
try (ResultSet set = executeQuery("SELECT username, vorname, nachname FROM realm.user WHERE login = " + username
+ " AND password = " + password + ";")) {
if (!set.next()) {
//Von Max und Knobie
try {
infoBox("Davor","Stop");
Statement statement = JDBCConnection.getInstance().getStatement();
infoBox("STOPP","Stop");
ResultSet set = statement.executeQuery("SELECT userid FROM login WHERE userid = " + username+ " AND password = " + password + ";");
if (!set.next()) {
throw new NoSuchUserOrPassword();
}
String vname = set.getString("vorname");
String nname = set.getString("nachname");
String uname = set.getString("username");
String vname = set.getString("userid");
String nname = set.getString("userid");
String uname = set.getString("userid");
infoBox(uname, "ARLAAAAAAARM");
return new User(vname, nname, uname);
} catch (SQLException ex) {
throw new DAOException(ex);
}
}
}
......@@ -56,7 +56,7 @@ public class JDBCConnection {
Logger.getLogger(JDBCConnection.class.getName()).log(Level.SEVERE, null, ex);
}
}
public Statement getStatement() {
try {
if (this.conn.isClosed()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment