aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-26 20:07:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-26 20:07:58 +1200
commit6919dc98ea4d546aea56e815c22fecc3a6c164c8 (patch)
treee05c4aed4922d3fdaed4dd51bce5938c0002f814 /src/org/traccar/database/DataManager.java
parentb2cbb5698ee7eea9abd811a6cc653b624b09e7d9 (diff)
downloadtrackermap-server-6919dc98ea4d546aea56e815c22fecc3a6c164c8.tar.gz
trackermap-server-6919dc98ea4d546aea56e815c22fecc3a6c164c8.tar.bz2
trackermap-server-6919dc98ea4d546aea56e815c22fecc3a6c164c8.zip
Change user name to email
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 5e12dc865..4b8f4d5e8 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -239,7 +239,7 @@ public class DataManager {
statement.execute(
"CREATE TABLE user (" +
"id INT PRIMARY KEY AUTO_INCREMENT," +
- "name VARCHAR(1024) NOT NULL UNIQUE," +
+ "email VARCHAR(1024) NOT NULL UNIQUE," +
"password VARCHAR(1024) NOT NULL," +
"salt VARCHAR(1024) NOT NULL," +
"readonly BOOLEAN DEFAULT false NOT NULL," +
@@ -322,15 +322,15 @@ public class DataManager {
}
}
- public long login(String name, String password) throws SQLException {
+ public long login(String email, String password) throws SQLException {
Connection connection = dataSource.getConnection();
try {
PreparedStatement statement = connection.prepareStatement(
- "SELECT id FROM user WHERE name = ? AND " +
+ "SELECT id FROM user WHERE email = ? AND " +
"password = CAST(HASH('SHA256', STRINGTOUTF8(?), 1000) AS VARCHAR);");
try {
- statement.setString(1, name);
+ statement.setString(1, email);
statement.setString(2, password);
ResultSet result = statement.executeQuery();
@@ -344,15 +344,15 @@ public class DataManager {
}
}
- public void addUser(String name, String password, boolean admin) throws SQLException {
+ public void addUser(String email, String password, boolean admin) throws SQLException {
Connection connection = dataSource.getConnection();
try {
PreparedStatement statement = connection.prepareStatement(
- "INSERT INTO user (name, password, salt, admin) " +
+ "INSERT INTO user (email, password, salt, admin) " +
"VALUES (?, CAST(HASH('SHA256', STRINGTOUTF8(?), 1000) AS VARCHAR), '', ?);");
try {
- statement.setString(1, name);
+ statement.setString(1, email);
statement.setString(2, password);
statement.setBoolean(3, admin);