]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/LoginPage.java
FIX: Correct location of ticket enter form
[gigi.git] / src / org / cacert / gigi / pages / LoginPage.java
index b19e8f5b5625d3e1bf64d8256769f9163b684998..128855fcf0dced4e2ed690cfda5c92fdc887ed88 100644 (file)
@@ -97,7 +97,15 @@ public class LoginPage extends Page {
         ps.setString(1, un);
         GigiResultSet rs = ps.executeQuery();
         if (rs.next()) {
-            if (PasswordHash.verifyHash(pw, rs.getString(1))) {
+            String dbHash = rs.getString(1);
+            String hash = PasswordHash.verifyHash(pw, dbHash);
+            if (hash != null) {
+                if ( !hash.equals(dbHash)) {
+                    GigiPreparedStatement gps = DatabaseConnection.getInstance().prepare("UPDATE `users` SET `password`=? WHERE `email`=?");
+                    gps.setString(1, hash);
+                    gps.setString(2, un);
+                    gps.executeUpdate();
+                }
                 loginSession(req, User.getById(rs.getInt(2)));
             }
         }