Pulls account creation online FULLY.
Deletion is still not supported.
This commit is contained in:
parent
1ad7ba95e1
commit
a059d62336
@ -17,7 +17,43 @@ public class emailVerify {
|
||||
static final String senderPassword = "aotskDEVSIGNSERVICE32143214";
|
||||
static final String emailSMTPserver = "smtp.gmail.com";
|
||||
static final String emailSMTPPort = "465";
|
||||
public static void Onboarding(String receiverEmail) {
|
||||
//get date for email
|
||||
Date date = new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
|
||||
String Date = formatter.format(date);
|
||||
//get time for sign in time
|
||||
Date dt = new Date();
|
||||
SimpleDateFormat dateFormat;
|
||||
dateFormat = new SimpleDateFormat("kk:mm:ss");
|
||||
|
||||
Properties props = new Properties();
|
||||
props.put("mail.smtp.host", emailSMTPserver);
|
||||
props.put("mail.smtp.socketFactory.port", emailSMTPPort);
|
||||
props.put("mail.smtp.socketFactory.class",
|
||||
"javax.net.ssl.SSLSocketFactory");
|
||||
props.put("mail.smtp.auth", "true");
|
||||
props.put("mail.smtp.port", emailSMTPPort);
|
||||
|
||||
try {
|
||||
Authenticator auth = new SMTPAuthenticator();
|
||||
Session session = Session.getInstance(props, auth);
|
||||
Message message = new MimeMessage(session);
|
||||
message.setFrom(new InternetAddress(senderEmailId));
|
||||
message.setRecipients(Message.RecipientType.TO,
|
||||
InternetAddress.parse(receiverEmail));
|
||||
message.setSubject("Welcome To Obsidian Core Studios!");
|
||||
message.setText("Seems You've Signed Up For An Account, We're Happy To have you here! \n \n \n \n \n " +
|
||||
"This Was Sent On Behalf Of Obsidian Core Studios By Our Super Cool Login Robots." +
|
||||
"\n You'll Only Get This Email Once (On-boarding Email).");
|
||||
|
||||
Transport.send(message);
|
||||
System.out.println("Sent Onboarding Email");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println("Email ONBOARD Not sent due to an error");
|
||||
}
|
||||
}
|
||||
public static void SendEmailThroughGmail(String receiverEmail, String User) {
|
||||
//get date for email
|
||||
Date date = new Date();
|
||||
|
@ -53,8 +53,8 @@ public class delegationServices {
|
||||
|
||||
System.out.println("Delegation Has Started");
|
||||
if(requesttype == 0 || requesttype == 1 || requesttype == 2 || requesttype == 3 || requesttype == 4 || requesttype == 5 || requesttype == 6 || requesttype ==7 || requesttype == 8 || requesttype ==9 || requesttype ==10 || requesttype ==11 || requesttype ==12) {
|
||||
if (requesttype == 7 || requesttype == 12) {
|
||||
System.out.println("An Excluded Request (7MAL) Has Been Detected, Ignoring");
|
||||
if (requesttype == 7 || requesttype == 12 || requesttype == 4 || requesttype == 5 || requesttype == 6) {
|
||||
System.out.println("An Excluded Request (7MAL, 12S, 4C, 5C, 6C) Has Been Detected, Ignoring");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -502,9 +502,90 @@ public class delegationServices {
|
||||
//delegationTimer.trigger();
|
||||
}
|
||||
}
|
||||
if (requesttype == 10)
|
||||
{
|
||||
delegationTimer.DeleteTargetRequest(ClientID);
|
||||
System.out.println("Account Creation Request");
|
||||
Document DServer = dCollection.find(eq("clientid",ClientID)).first();
|
||||
String User = (String) DServer.get("User");
|
||||
String Password = (String) DServer.get("Password");
|
||||
String Email = (String) DServer.get("Email");
|
||||
String FName = (String) DServer.get("FName");
|
||||
int min = 100000000;
|
||||
int max = 999999999;
|
||||
double tokenGEN = Math.random()*(max-min+1)+min;
|
||||
int tokenSTGEN = (int) tokenGEN;
|
||||
|
||||
//verify open cert
|
||||
try {
|
||||
Document DupeUser = accountS.find(eq("User", User)).first();
|
||||
String DUPE = (String) DupeUser.get("User");
|
||||
BasicDBObject searchQuery = new BasicDBObject();
|
||||
searchQuery.append("clientid", ClientID);
|
||||
|
||||
BasicDBObject updateQuery = new BasicDBObject();
|
||||
BasicDBObject updateQuery1 = new BasicDBObject();
|
||||
updateQuery.append("$set",
|
||||
new BasicDBObject().append("type", 6));
|
||||
updateQuery1.append("$set",
|
||||
new BasicDBObject().append("status", true));
|
||||
dCollection.updateOne(searchQuery, updateQuery);
|
||||
dCollection.updateOne(searchQuery, updateQuery1);
|
||||
} catch (Exception exr) {
|
||||
System.out.println("Username Is Open");
|
||||
try {
|
||||
Document DupeToken = accountS.find(eq("Token", tokenSTGEN)).first();
|
||||
int DupeToke1n = (int) DupeToken.get("Token");
|
||||
|
||||
Boolean TokenOpen = false;
|
||||
while (TokenOpen == false) {
|
||||
tokenGEN = Math.random()*(max-min+1)+min;
|
||||
tokenSTGEN = (int) tokenGEN;
|
||||
try {
|
||||
DupeToken = accountS.find(eq("Token", tokenSTGEN)).first();
|
||||
DupeToke1n = (int) DupeToken.get("Token");
|
||||
System.out.println("Token Is Reserved, Try Again.");
|
||||
tokenGEN = Math.random()*(max-min+1)+min;
|
||||
tokenSTGEN = (int) tokenGEN;
|
||||
} catch (Exception exDr) {
|
||||
TokenOpen = true;
|
||||
System.out.println("Token Free (While EXP)");
|
||||
}
|
||||
}
|
||||
} catch (Exception exrs) {
|
||||
System.out.println("Token Free (Main)");
|
||||
System.out.println("Creating.");
|
||||
Document createForm = new Document();
|
||||
createForm.append("User", User);
|
||||
createForm.append("Password", Password);
|
||||
createForm.append("Status", true);
|
||||
createForm.append("Flagged", false);
|
||||
createForm.append("Email", Email);
|
||||
createForm.append("FName", FName);
|
||||
createForm.append("Entitlements", "NA");
|
||||
createForm.append("Path", "C:\\ObsidianCoreStudios\\Launcher\\AOTSK\\");
|
||||
createForm.append("Freinds", " ");
|
||||
createForm.append("Token", tokenSTGEN);
|
||||
createForm.append("Control", 1);
|
||||
accountS.insertOne(createForm);
|
||||
BasicDBObject searchQuery = new BasicDBObject();
|
||||
searchQuery.append("clientid", ClientID);
|
||||
com.jamesquinley.Asecure.emailVerify.Onboarding(Email);
|
||||
BasicDBObject updateQuery = new BasicDBObject();
|
||||
BasicDBObject updateQuery1 = new BasicDBObject();
|
||||
updateQuery.append("$set",
|
||||
new BasicDBObject().append("type", 4));
|
||||
updateQuery1.append("$set",
|
||||
new BasicDBObject().append("status", true));
|
||||
dCollection.updateOne(searchQuery, updateQuery);
|
||||
dCollection.updateOne(searchQuery, updateQuery1);
|
||||
System.out.println("Update Request With Finished Status");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("Malformed Request, Non Recoverable");
|
||||
|
Loading…
x
Reference in New Issue
Block a user