Account System v0.1
Posted: Sun Sep 12, 2021 8:42 pm
Here it is a long awaited feature for UOX3
Your Players will be able to set their Email and Password.
It will check to make sure its a real Email.
It will check Email length
It will check Password length
It will check Password characters
They can do this as many times as they wish.
You can change the Shard Name on it as well.
Your Players will be able to set their Email and Password.
It will check to make sure its a real Email.
It will check Email length
It will check Password length
It will check Password characters
They can do this as many times as they wish.
You can change the Shard Name on it as well.
///////////////////////////////////////////
// Account System Version 0.1 //
// Written by Dragon Slayer //
///////////////////////////////////////////
function CommandRegistration()
{
RegisterCommand( "acc", 2, true );
}
function command_ACC( socket, cmdString )
{
var pUser = socket.currentChar;
AccountSystem( pUser );
}
var shardname = "Your Shard Name Here";
function AccountSystem(pUser)
{
var socket = pUser.socket;
var Account = new Gump;
Account.AddPage(0);
Account.AddPage(0);
Account.AddBackground(130, 74, 414, 239, 9200);
Account.AddCheckerTrans(141, 109, 182, 164);
//Account.AddCheckerTrans(333, 114, 201, 19);
Account.AddCheckerTrans(335, 140, 201, 19);
Account.AddCheckerTrans(336, 166, 201, 19);
//Account.AddCheckerTrans(334, 193, 201, 19);
Account.AddCheckerTrans(335, 219, 201, 19);
Account.AddCheckerTrans(334, 246, 201, 19);
Account.AddText(262, 85, 2727, "Set E-Mail and Password");
Account.AddText(400, 286, 2727, shardname);
//Account.AddText(151, 114, 2727, "Magic Word:");
Account.AddText(151, 141, 2727, "E-Mail:");
Account.AddText(149, 167, 2727, "Confirm E-Mail:");
//Account.AddText(149, 194, 2727, "Current Password:");
Account.AddText(147, 218, 2727, "New Password:");
Account.AddText(149, 246, 2727, "Confirm New Password:");
//Account.AddTextEntry(334, 115, 200, 20, 1175, 0, 1, "");//Magic Word
Account.AddTextEntry(334, 140, 200, 20, 1175, 0, 7, " ");//E-Mail:
Account.AddTextEntry(335, 166, 200, 20, 1175, 0, 8, " ");//Confirm E-Mail:
//Account.AddTextEntry(335, 193, 200, 20, 1175, 0, 7, "");//Current Password:
Account.AddTextEntry(335, 219, 200, 20, 1175, 0, 9, " ");//New Password:
Account.AddTextEntry(334, 245, 200, 20, 1175, 0, 10, " ");//Confirm New Password:
Account.AddButton(144, 281, 247, 248, 1, 0, 1);
Account.Send(pUser);
Account.Free();
}
function onGumpPress(pSock, pButton, gumpData)
{
var pUser = pSock.currentChar;
var userAccount = pUser.account;
var email = gumpData.getEdit(0);
var confirmemail = gumpData.getEdit(1);
var password = gumpData.getEdit(2);
var confirmpassword = gumpData.getEdit(3);
var letterNumber = /^[0-9a-zA-Z]+$/;
var passwordmatch = password.match(letterNumber);
var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
var mail = email.match(mailformat);
switch (pButton)
{
case 0:
break;
case 1:
if (email.length <= 6 || email.length > 40) // Estimated longest name that fits inside gump
{
pUser.SysMessage("Your e-mail must be at least 7 letters or numbers.");
AccountSystem(pUser)
break;
}
if (email != confirmemail)
{
pUser.SysMessage("The 'Confirm Email' value does not match the 'Email'. ");
AccountSystem(pUser)
break;
}
if (!passwordmatch)
{
pUser.SysMessage("Passwords may only consist of letters (A - Z) and Digits (0 - 9).");
AccountSystem(pUser)
break;
}
if (!mail)
{
pUser.SysMessage("You have entered an invalid email address!");
AccountSystem(pUser)
break;
}
if (password.length <= 6 || password.length > 40)
{
pUser.SysMessage("Your Password must be at least 7 letters or numbers.");
AccountSystem(pUser)
break;
}
if (password != confirmpassword)
{
pUser.SysMessage("The 'Confirm New Password' value does not match the 'New Password'. Remember it is cAsE sEnSiTiVe. ");
AccountSystem(pUser)
break;
}
if (password == confirmpassword)
{
pUser.SysMessage("You Set the account Email: " + email);
userAccount.comment = email;
pUser.SysMessage("You Set the new Password: " + password);
userAccount.password = password;
break;
}
break;
}
}
// Account System Version 0.1 //
// Written by Dragon Slayer //
///////////////////////////////////////////
function CommandRegistration()
{
RegisterCommand( "acc", 2, true );
}
function command_ACC( socket, cmdString )
{
var pUser = socket.currentChar;
AccountSystem( pUser );
}
var shardname = "Your Shard Name Here";
function AccountSystem(pUser)
{
var socket = pUser.socket;
var Account = new Gump;
Account.AddPage(0);
Account.AddPage(0);
Account.AddBackground(130, 74, 414, 239, 9200);
Account.AddCheckerTrans(141, 109, 182, 164);
//Account.AddCheckerTrans(333, 114, 201, 19);
Account.AddCheckerTrans(335, 140, 201, 19);
Account.AddCheckerTrans(336, 166, 201, 19);
//Account.AddCheckerTrans(334, 193, 201, 19);
Account.AddCheckerTrans(335, 219, 201, 19);
Account.AddCheckerTrans(334, 246, 201, 19);
Account.AddText(262, 85, 2727, "Set E-Mail and Password");
Account.AddText(400, 286, 2727, shardname);
//Account.AddText(151, 114, 2727, "Magic Word:");
Account.AddText(151, 141, 2727, "E-Mail:");
Account.AddText(149, 167, 2727, "Confirm E-Mail:");
//Account.AddText(149, 194, 2727, "Current Password:");
Account.AddText(147, 218, 2727, "New Password:");
Account.AddText(149, 246, 2727, "Confirm New Password:");
//Account.AddTextEntry(334, 115, 200, 20, 1175, 0, 1, "");//Magic Word
Account.AddTextEntry(334, 140, 200, 20, 1175, 0, 7, " ");//E-Mail:
Account.AddTextEntry(335, 166, 200, 20, 1175, 0, 8, " ");//Confirm E-Mail:
//Account.AddTextEntry(335, 193, 200, 20, 1175, 0, 7, "");//Current Password:
Account.AddTextEntry(335, 219, 200, 20, 1175, 0, 9, " ");//New Password:
Account.AddTextEntry(334, 245, 200, 20, 1175, 0, 10, " ");//Confirm New Password:
Account.AddButton(144, 281, 247, 248, 1, 0, 1);
Account.Send(pUser);
Account.Free();
}
function onGumpPress(pSock, pButton, gumpData)
{
var pUser = pSock.currentChar;
var userAccount = pUser.account;
var email = gumpData.getEdit(0);
var confirmemail = gumpData.getEdit(1);
var password = gumpData.getEdit(2);
var confirmpassword = gumpData.getEdit(3);
var letterNumber = /^[0-9a-zA-Z]+$/;
var passwordmatch = password.match(letterNumber);
var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
var mail = email.match(mailformat);
switch (pButton)
{
case 0:
break;
case 1:
if (email.length <= 6 || email.length > 40) // Estimated longest name that fits inside gump
{
pUser.SysMessage("Your e-mail must be at least 7 letters or numbers.");
AccountSystem(pUser)
break;
}
if (email != confirmemail)
{
pUser.SysMessage("The 'Confirm Email' value does not match the 'Email'. ");
AccountSystem(pUser)
break;
}
if (!passwordmatch)
{
pUser.SysMessage("Passwords may only consist of letters (A - Z) and Digits (0 - 9).");
AccountSystem(pUser)
break;
}
if (!mail)
{
pUser.SysMessage("You have entered an invalid email address!");
AccountSystem(pUser)
break;
}
if (password.length <= 6 || password.length > 40)
{
pUser.SysMessage("Your Password must be at least 7 letters or numbers.");
AccountSystem(pUser)
break;
}
if (password != confirmpassword)
{
pUser.SysMessage("The 'Confirm New Password' value does not match the 'New Password'. Remember it is cAsE sEnSiTiVe. ");
AccountSystem(pUser)
break;
}
if (password == confirmpassword)
{
pUser.SysMessage("You Set the account Email: " + email);
userAccount.comment = email;
pUser.SysMessage("You Set the new Password: " + password);
userAccount.password = password;
break;
}
break;
}
}