Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 08aaf3 ... vs be3833 ... for ruralHouses/src/businessLogic/LoginManager.java

Diff revisions: vs.
  @@ -1,6 +1,5 @@
1 1 package businessLogic;
2 2
3 -
4 3 import java.rmi.RemoteException;
5 4 import java.rmi.server.UnicastRemoteObject;
6 5 import java.util.Vector;
  @@ -10,7 +9,6 @@
10 9 import dataAccess.DB4oManager;
11 10 import domain.Account;
12 11
13 -
14 12 public class LoginManager extends UnicastRemoteObject implements LoginInterface {
15 13
16 14 /**
  @@ -19,7 +17,7 @@
19 17 private static final long serialVersionUID = 1L;
20 18 DB4oManager dbMngr;
21 19
22 - public LoginManager() throws RemoteException {
20 + public LoginManager() throws RemoteException {
23 21 super();
24 22 try {
25 23 dbMngr = DB4oManager.getInstance();
  @@ -30,18 +28,21 @@
30 28
31 29 @Override
32 30 public Account checkCredentials(String usr, String pwd) {
33 - Account ac = new Account(SecurityManager.getInstance().calculateHash(usr));
31 + Account ac = new Account(SecurityManager.getInstance().calculateHash(
32 + usr));
34 33 try {
35 34 Vector<Account> account = dbMngr.getAccount(ac);
36 - if (SecurityManager.getInstance().isExpectedPassword(pwd.toCharArray(), account
37 - .get(0).getSalt(), account.get(0).getPassword())) {
38 -
35 + if (account.isEmpty())
36 + return null;
37 + if (SecurityManager.getInstance().isExpectedPassword(
38 + pwd.toCharArray(), account.get(0).getSalt(),
39 + account.get(0).getPassword())) {
40 +
39 41 return account.get(0);
40 42 }
41 43 return null;
42 44
43 45 } catch (Exception e) {
44 - // TODO Auto-generated catch block
45 46 e.printStackTrace();
46 47 }
47 48 return null;