Account deletion is now stable and safe to launch, other features will be getting bugfixes to make the server software more stable.
This commit is contained in:
parent
1c25899408
commit
31603e5ccc
@ -96,7 +96,7 @@ public class electronicMailHandler {
|
|||||||
"This email is for, " + User + ". If this is not your account, ignore this and check who has your email.");
|
"This email is for, " + User + ". If this is not your account, ignore this and check who has your email.");
|
||||||
|
|
||||||
Transport.send(message);
|
Transport.send(message);
|
||||||
System.out.println("Sent Onboarding Email");
|
System.out.println("Sent goodbye Email");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
@ -220,6 +220,48 @@ public class electronicMailHandler {
|
|||||||
System.err.println("Was Not Sent Because Of An Error.");
|
System.err.println("Was Not Sent Because Of An Error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void otkDeletionEmailResend (String receiverEmail, String Key, String User) {
|
||||||
|
//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("Obsidian Core Account Notice");
|
||||||
|
message.setText("It seems you've tried to delete your account in the past, and clicked the button again so here's the same info." +
|
||||||
|
"\nHey there, as you may have seen in the launcher, you need a one time key to delete your account, this email can help! " +
|
||||||
|
"\nBefore we give you the required key to continue, a gentle reminder to NEVER SHARE YOUR PASSWORD OR ONE TIME KEY! " +
|
||||||
|
"\nWell, good luck! Your one time key is: " + Key +
|
||||||
|
"\nThis key will remain active until used, it was generated at your login attempt, and won't be regenerated after the initial creation of said key." +
|
||||||
|
"\nThis key will only work with the account tied to the username: " + User + ", and will only work one time, its in the name." +
|
||||||
|
"\nWe're sorry to see you go.");
|
||||||
|
|
||||||
|
Transport.send(message);
|
||||||
|
System.out.println("Alert RESent");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.err.println("Was Not Sent Because Of An Error.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void otkMigrate (String receiverEmail, String User) {
|
public static void otkMigrate (String receiverEmail, String User) {
|
||||||
//get date for email
|
//get date for email
|
||||||
|
@ -25,8 +25,7 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.jamesquinley.Asecure.electronicMailHandler.offBoarding;
|
import static com.jamesquinley.Asecure.electronicMailHandler.*;
|
||||||
import static com.jamesquinley.Asecure.electronicMailHandler.otkDeletionEmail;
|
|
||||||
import static com.jamesquinley.Asecure.secureCalls.accountMigrationComplete;
|
import static com.jamesquinley.Asecure.secureCalls.accountMigrationComplete;
|
||||||
import static com.mongodb.client.model.Filters.eq;
|
import static com.mongodb.client.model.Filters.eq;
|
||||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||||
@ -1466,13 +1465,6 @@ public class delegationServices {
|
|||||||
File myObj = new File(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt");
|
File myObj = new File(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt");
|
||||||
if (myObj.createNewFile()) {
|
if (myObj.createNewFile()) {
|
||||||
System.out.println("Log File created: " + myObj.getName());
|
System.out.println("Log File created: " + myObj.getName());
|
||||||
} else {
|
|
||||||
System.out.println("Log already exists.");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println("An error occurred.");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
FileWriter writer = new FileWriter(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt", true);
|
FileWriter writer = new FileWriter(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt", true);
|
||||||
writer.write("This bug report is for: " + applicationName);
|
writer.write("This bug report is for: " + applicationName);
|
||||||
writer.write("\r\n");
|
writer.write("\r\n");
|
||||||
@ -1486,6 +1478,13 @@ public class delegationServices {
|
|||||||
writer.write("\r\n");
|
writer.write("\r\n");
|
||||||
writer.write("Submission Time (Local To Server): " + timeCurrent);
|
writer.write("Submission Time (Local To Server): " + timeCurrent);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
System.out.println("Log already exists.");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("An error occurred when attempting to log.");
|
||||||
|
}
|
||||||
BasicDBObject updateQuery = new BasicDBObject();
|
BasicDBObject updateQuery = new BasicDBObject();
|
||||||
updateQuery.append("$set",
|
updateQuery.append("$set",
|
||||||
new BasicDBObject().append("status", true));
|
new BasicDBObject().append("status", true));
|
||||||
@ -1508,13 +1507,6 @@ public class delegationServices {
|
|||||||
File myObj = new File(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt");
|
File myObj = new File(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt");
|
||||||
if (myObj.createNewFile()) {
|
if (myObj.createNewFile()) {
|
||||||
System.out.println("Log File created: " + myObj.getName());
|
System.out.println("Log File created: " + myObj.getName());
|
||||||
} else {
|
|
||||||
System.out.println("Log already exists.");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println("An error occurred.");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
FileWriter writer = new FileWriter(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt", true);
|
FileWriter writer = new FileWriter(homedir + "/ocs/logs/" + applicationName + bugDetails + timeCurrent +".txt", true);
|
||||||
writer.write("This bug report is for: " + applicationName);
|
writer.write("This bug report is for: " + applicationName);
|
||||||
writer.write("\r\n");
|
writer.write("\r\n");
|
||||||
@ -1532,6 +1524,12 @@ public class delegationServices {
|
|||||||
writer.write("\r\n");
|
writer.write("\r\n");
|
||||||
writer.write(bugLog);
|
writer.write(bugLog);
|
||||||
writer.close();
|
writer.close();
|
||||||
|
} else {
|
||||||
|
System.out.println("Log already exists.");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("An error occurred while attempting to log.");
|
||||||
|
}
|
||||||
BasicDBObject updateQuery = new BasicDBObject();
|
BasicDBObject updateQuery = new BasicDBObject();
|
||||||
updateQuery.append("$set",
|
updateQuery.append("$set",
|
||||||
new BasicDBObject().append("status", true));
|
new BasicDBObject().append("status", true));
|
||||||
@ -1606,6 +1604,19 @@ public class delegationServices {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (requesttype == 67)
|
if (requesttype == 67)
|
||||||
|
{
|
||||||
|
String OTK = "keyNotSetDueToError(ERR24)";
|
||||||
|
Boolean keyStatus = false;
|
||||||
|
//default false, since will be set to true if the mesurement exists on linked account
|
||||||
|
String accountUUID = (String) Lrequest.get("uuid");
|
||||||
|
Document linkedAccount = accountS.find(eq("UUID", accountUUID)).first();
|
||||||
|
try {
|
||||||
|
keyStatus = (boolean)linkedAccount.get("delStatus");
|
||||||
|
} catch (Exception NPE)
|
||||||
|
{
|
||||||
|
keyStatus = false;
|
||||||
|
}
|
||||||
|
if (keyStatus == false)
|
||||||
{
|
{
|
||||||
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
|
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@ -1616,24 +1627,29 @@ public class delegationServices {
|
|||||||
char randomChar = alphabet.charAt(index);
|
char randomChar = alphabet.charAt(index);
|
||||||
sb.append(randomChar);
|
sb.append(randomChar);
|
||||||
}
|
}
|
||||||
|
OTK = sb.toString();
|
||||||
String OTK = sb.toString();
|
|
||||||
String accountUUID = (String) Lrequest.get("uuid");
|
|
||||||
BasicDBObject deleteKey = new BasicDBObject();
|
BasicDBObject deleteKey = new BasicDBObject();
|
||||||
BasicDBObject searchQuery = new BasicDBObject();
|
BasicDBObject deleteKeyStatus = new BasicDBObject();
|
||||||
searchQuery.append("UUID", accountUUID);
|
BasicDBObject deleteTie = new BasicDBObject();
|
||||||
|
deleteTie.append("UUID", accountUUID);
|
||||||
deleteKey.append("$set",
|
deleteKey.append("$set",
|
||||||
new BasicDBObject().append("delOTK",OTK));
|
new BasicDBObject().append("delOTK",OTK));
|
||||||
accountS.updateOne(searchQuery, deleteKey);
|
deleteKeyStatus.append("$set",
|
||||||
|
new BasicDBObject().append("delStatus",true));
|
||||||
|
accountS.updateOne(deleteTie, deleteKey);
|
||||||
|
accountS.updateOne(deleteTie, deleteKeyStatus);
|
||||||
|
otkDeletionEmail((String)linkedAccount.get("Email"),OTK,(String)linkedAccount.get("User"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
otkDeletionEmailResend((String)linkedAccount.get("Email"),(String)linkedAccount.get("delOTK"),(String)linkedAccount.get("User"));
|
||||||
|
}
|
||||||
BasicDBObject clearCL = new BasicDBObject();
|
BasicDBObject clearCL = new BasicDBObject();
|
||||||
clearCL.append("clientid", ClientID);
|
clearCL.append("clientid", ClientID);
|
||||||
BasicDBObject clearUO = new BasicDBObject();
|
BasicDBObject clearUO = new BasicDBObject();
|
||||||
clearUO.append("$set",
|
clearUO.append("$set",
|
||||||
new BasicDBObject().append("status", true));
|
new BasicDBObject().append("status", true));
|
||||||
dCollection.updateOne(clearCL, clearUO);
|
dCollection.updateOne(clearCL, clearUO);
|
||||||
System.out.println("Finished Del Generation");
|
|
||||||
Document linkedAccount = accountS.find(eq("UUID", accountUUID)).first();
|
|
||||||
otkDeletionEmail((String)linkedAccount.get("Email"),OTK,(String)linkedAccount.get("User"));
|
|
||||||
com.jamesquinley.DelegationServices.delegationTimer.DeleteTargetRequestQuick(ClientID);
|
com.jamesquinley.DelegationServices.delegationTimer.DeleteTargetRequestQuick(ClientID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,6 +15,5 @@ public class init
|
|||||||
System.out.println( "We're starting the login delegation server, please wait one moment while we check a few things.");
|
System.out.println( "We're starting the login delegation server, please wait one moment while we check a few things.");
|
||||||
com.jamesquinley.DelegationServices.delegationTimer.trigger();
|
com.jamesquinley.DelegationServices.delegationTimer.trigger();
|
||||||
System.out.println("We've started everything, requests are now being served");
|
System.out.println("We've started everything, requests are now being served");
|
||||||
com.jamesquinley.testing.splitFNet.splitNet();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user