Slight Tweak In Emails

This commit is contained in:
James Quinley 2022-03-20 20:32:17 -07:00
parent ac8996490b
commit 37939a7f8a
3 changed files with 44 additions and 9 deletions

View File

@ -45,7 +45,7 @@ public class emailVerify {
message.setSubject("Welcome To Obsidian Core Studios!");
message.setText("Seems you've signed up for an account we're happy you're here, and welcome to the Obsidian Core Studios Family! \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 Type Email Once.");
"\n You'll Only Get This Email Once.");
Transport.send(message);
System.out.println("Sent Onboarding Email");
@ -54,7 +54,7 @@ public class emailVerify {
System.err.println("Email ONBOARD Not sent due to an error");
}
}
public static void SendEmailThroughGmail(String receiverEmail, String User) {
public static void newLocation (String receiverEmail, String User, String Adr, String OldAdr) {
//get date for email
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yy");
@ -80,8 +80,9 @@ public class emailVerify {
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(receiverEmail));
message.setSubject("Obsidian Core Account Login Notice | " + Date);
message.setText("We detected a new login on your account " +"(at " + dateFormat.format(dt) + " PDT)" + ". If this was you ignore this email, if it wasn't you, please change your password. \n \n \n \n" +
" \n This email (" + receiverEmail + ") is linked to the Obsidian Core Account "+ User + " \n These security emails can't be opted out of. \n \n This was sent on behalf of Obsidian Core Studios by our super cool login robots.");
message.setText("Something Seems Fishy, A Login Was Detected At A New Location (" + Adr + " Compared To Your Last Logon " + OldAdr +") "+"(at " + dateFormat.format(dt) + " PST)" + ". If this was you ignore this email, if it wasn't you, please contact us (Respond To This Email).\n\n\n\n" +
" \nThis email (" + receiverEmail + ") is linked to the Obsidian Core Account "+ User + " \nThese security emails can't be opted out of. \n\nThis was sent on behalf of Obsidian Core Studios by our super cool login robots.\n\n\n\n" +
"The MAC address used has been set as your account's default ("+Adr + ")");
Transport.send(message);
System.out.println("Alert Sent");

View File

@ -71,6 +71,8 @@ public class delegationServices {
static MongoCollection<Document> FNETDOC = accountDatabase.getCollection("FNet");
static int RequestR;
//still need to config
public static String lastNet = null;
public static String Macid = null;
public static void delegationProcesser() {
int ClientID = 0;
Document Lrequest = dCollection.find(eq("status", false)).first();
@ -84,8 +86,11 @@ public class delegationServices {
try {
try {
ClientID = (int) Lrequest.get("clientid");
Macid = (String) Lrequest.get("net");
System.out.println(Macid);
} catch (Exception exrp) {
System.out.println("Failed To Get Client ID");
System.out.println("Failed To Get Client ID & MacAdr");
delegationTimer.DeleteTargetRequest(ClientID);
}
@ -348,7 +353,9 @@ public class delegationServices {
Path = (String) accountServer.get("Path");
Email = (String) accountServer.get("Email");
UserName = (String) accountServer.get("User");
com.jamesquinley.Asecure.emailVerify.SendEmailThroughGmail(Email, UserName);
lastNet = (String) accountServer.get("lastNet");
localNet.macRead(Macid,lastNet,Email,UserName,Token);
// com.jamesquinley.Asecure.emailVerify.SendEmailThroughGmail(Email, UserName);
BasicDBObject searchQuery = new BasicDBObject();
searchQuery.append("clientid", ClientID);
@ -456,9 +463,10 @@ public class delegationServices {
Fname = (String) accountServer.get("FName");
Path = (String) accountServer.get("Path");
Email = (String) accountServer.get("Email");
UserName = (String) accountServer.get("User");
com.jamesquinley.Asecure.emailVerify.SendEmailThroughGmail(Email, UserName);
lastNet = (String) accountServer.get("lastNet");
localNet.macRead(Macid,lastNet,Email,UserName,TKN);
// com.jamesquinley.Asecure.emailVerify.SendEmailThroughGmail(Email, UserName);
BasicDBObject searchQuery = new BasicDBObject();
searchQuery.append("clientid", ClientID);
@ -727,6 +735,7 @@ public class delegationServices {
createForm.append("Token", tokenSTGEN);
createForm.append("Control", 1);
createForm.append("Upgrade", 0);
createForm.append("lastNet", Macid);
accountS.insertOne(createForm);
FnetInit.append("User", User);
FnetInit.append("Status", true);

View File

@ -0,0 +1,25 @@
package com.jamesquinley.DelegationServices;
import com.mongodb.BasicDBObject;
import static com.jamesquinley.DelegationServices.delegationServices.accountS;
public class localNet {
public static void macRead (String NewMac, String OldMac, String email, String UName, int Token)
{
if (NewMac.equals(OldMac))
{
System.out.println("User Logged In From A Known Computer, not sending email");
} else
{
System.out.println("Hey this user Logged In From A new Location, dispatching email!");
com.jamesquinley.Asecure.emailVerify.newLocation(email,UName,NewMac, OldMac);
System.out.println("Switching Trusted Net To New Local");
BasicDBObject searchQuery = new BasicDBObject();
searchQuery.append("Token", Token);
BasicDBObject updateQuery = new BasicDBObject();
updateQuery.append("$set", new BasicDBObject().append("lastNet", NewMac));
accountS.updateOne(searchQuery, updateQuery);
}
}
}