-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignup.java
More file actions
49 lines (37 loc) · 1.24 KB
/
Copy pathSignup.java
File metadata and controls
49 lines (37 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* This file process the user registration and store
* thier username and password with their hydrogen/ethereum
* address. It also whitelist using the whitelist method in Hydrogen class
* and stored 'hydro_address_id' in the database.
*/
public class Signup {
// Process login method
public boolean process(String username, String password, String address){
boolean available = checkUserDB(username, password);
if(!available){
boolean whitelisted = isWhiteListed(address);
if(!whitelisted){
whitelistAddress(address);
}
insertIntoDB(username, password, address);
return true;
}else{
return false;
}
}
// Method checkUserDB
private boolean checkUserDB(string uname, String pass){
return DBUtil.checkRegistered(uname, pass);
}
// Method insertIntoDB
private void insertIntoDB(string uname, String pass, String address){
DBUtil.insertIntoDB(uname, pass, address);
}
// Method to check if address is whitelisted
private boolean isWhiteListed(string address){
return DBUtil.isWhiteListed(address);
}
// Method to whitelist address
private void whitelistAddress(string address){
HydrogenAPI.whiteList(address);
}
}