mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 19:22:56 +00:00
added safety checks for bad values in eftpos + atms
Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -101,7 +101,11 @@
|
|||||||
if("change_code")
|
if("change_code")
|
||||||
var/attempt_code = input("Re-enter the current EFTPOS access code", "Confirm old EFTPOS code") as num
|
var/attempt_code = input("Re-enter the current EFTPOS access code", "Confirm old EFTPOS code") as num
|
||||||
if(attempt_code == access_code)
|
if(attempt_code == access_code)
|
||||||
access_code = input("Enter a new access code for this device", "Enter new EFTPOS code") as num
|
var/trycode = input("Enter a new access code for this device (4-6 digits, numbers only)", "Enter new EFTPOS code") as num
|
||||||
|
if(trycode >= 1000 && trycode <= 999999)
|
||||||
|
access_code = trycode
|
||||||
|
else
|
||||||
|
alert("That is not a valid code!")
|
||||||
print_reference()
|
print_reference()
|
||||||
else
|
else
|
||||||
usr << "\icon[src]<span class='warning'>Incorrect code entered.</span>"
|
usr << "\icon[src]<span class='warning'>Incorrect code entered.</span>"
|
||||||
@@ -124,7 +128,11 @@
|
|||||||
if("trans_purpose")
|
if("trans_purpose")
|
||||||
transaction_purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose")
|
transaction_purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose")
|
||||||
if("trans_value")
|
if("trans_value")
|
||||||
transaction_amount = input("Enter amount for EFTPOS transaction", "Transaction amount") as num
|
var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount") as num
|
||||||
|
if(try_num < 0)
|
||||||
|
alert("That is not a valid amount!")
|
||||||
|
else
|
||||||
|
transaction_amount = try_num
|
||||||
if("toggle_lock")
|
if("toggle_lock")
|
||||||
if(transaction_locked)
|
if(transaction_locked)
|
||||||
var/attempt_code = input("Enter EFTPOS access code", "Reset Transaction") as num
|
var/attempt_code = input("Enter EFTPOS access code", "Reset Transaction") as num
|
||||||
|
|||||||
@@ -206,10 +206,12 @@ log transactions
|
|||||||
switch(href_list["choice"])
|
switch(href_list["choice"])
|
||||||
if("transfer")
|
if("transfer")
|
||||||
if(authenticated_account && linked_db)
|
if(authenticated_account && linked_db)
|
||||||
var/target_account_number = text2num(href_list["target_acc_number"])
|
|
||||||
var/transfer_amount = text2num(href_list["funds_amount"])
|
var/transfer_amount = text2num(href_list["funds_amount"])
|
||||||
var/transfer_purpose = href_list["purpose"]
|
if(transfer_amount <= 0)
|
||||||
if(transfer_amount <= authenticated_account.money)
|
alert("That is not a valid amount.")
|
||||||
|
else if(transfer_amount <= authenticated_account.money)
|
||||||
|
var/target_account_number = text2num(href_list["target_acc_number"])
|
||||||
|
var/transfer_purpose = href_list["purpose"]
|
||||||
if(linked_db.charge_to_account(target_account_number, authenticated_account.owner_name, transfer_purpose, machine_id, transfer_amount))
|
if(linked_db.charge_to_account(target_account_number, authenticated_account.owner_name, transfer_purpose, machine_id, transfer_amount))
|
||||||
usr << "\icon[src]<span class='info'>Funds transfer successful.</span>"
|
usr << "\icon[src]<span class='info'>Funds transfer successful.</span>"
|
||||||
authenticated_account.money -= transfer_amount
|
authenticated_account.money -= transfer_amount
|
||||||
@@ -284,7 +286,9 @@ log transactions
|
|||||||
previous_account_number = tried_account_num
|
previous_account_number = tried_account_num
|
||||||
if("withdrawal")
|
if("withdrawal")
|
||||||
var/amount = max(text2num(href_list["funds_amount"]),0)
|
var/amount = max(text2num(href_list["funds_amount"]),0)
|
||||||
if(authenticated_account && amount > 0)
|
if(amount <= 0)
|
||||||
|
alert("That is not a valid amount.")
|
||||||
|
else if(authenticated_account && amount > 0)
|
||||||
if(amount <= authenticated_account.money)
|
if(amount <= authenticated_account.money)
|
||||||
playsound(src, 'chime.ogg', 50, 1)
|
playsound(src, 'chime.ogg', 50, 1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user