Adds better use feedback to Nanobank and Pin Changing (#20084)

* guh

* Update code/modules/economy/economy_machinery/account_terminal.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
This commit is contained in:
Ryan
2023-01-13 16:27:43 +01:00
committed by GitHub
co-authored by Henri215
parent 428ece899f
commit 748405409d
5 changed files with 50 additions and 5 deletions
@@ -17,6 +17,13 @@
///station account database
var/datum/money_account_database/account_db
/obj/machinery/computer/account_database/Initialize()
. = ..()
reconnect_database()
/obj/machinery/computer/account_database/proc/reconnect_database()
account_db = GLOB.station_money_database
/obj/machinery/computer/account_database/attackby(obj/O, mob/user, params)
if(ui_login_attackby(O, user))
return
@@ -35,7 +42,6 @@
var/list/data = list()
data["currentPage"] = current_page
ui_login_data(data, user)
if(data["loginState"]["logged_in"])
switch(current_page)
if(AUT_ACCLST)
@@ -76,7 +82,7 @@
return data
/obj/machinery/computer/account_database/ui_act(action, list/params)
/obj/machinery/computer/account_database/ui_act(action, list/params, datum/tgui/ui)
if(..())
return
@@ -88,6 +94,9 @@
if(!ui_login_get().logged_in)
return
if(!account_db)
reconnect_database()
switch(action)
if("view_account_detail")
var/account_num = text2num(params["account_num"])
@@ -97,6 +106,24 @@
current_page = AUT_ACCINF
if("back")
clear_viewed_account()
if("set_account_pin")
var/account_num = text2num(params["account_number"])
if(!account_num || !detailed_account_view)
return
var/attempt_pin = input("Enter this accounts current pin code", "Account Auth") as num
if(!attempt_pin || !Adjacent(ui.user))
return
if(!account_db.try_authenticate_login(detailed_account_view, attempt_pin, FALSE, FALSE, FALSE) || detailed_account_view.account_pin != attempt_pin)
to_chat(ui.user, "<span class='warning'>Authentification Failure: Incorrect Pin or insufficient access.</span>")
return
var/new_pin = input("Enter the new pin for this account", "New Account Pin") as num
if(!new_pin || !Adjacent(ui.user))
return
if(new_pin < 1 || new_pin >= 1000000)
to_chat(ui.user, "<span class='warning'>Account Error: New pin must be a number between 000001 and 999999.</span>")
return
detailed_account_view.account_pin = new_pin
to_chat(ui.user, "<span class='notice'>The [detailed_account_view.account_name] account pin has been set to [new_pin] successfully.</span>")
if("toggle_suspension")
if(detailed_account_view)
detailed_account_view.suspended = !detailed_account_view.suspended
+7 -1
View File
@@ -151,9 +151,15 @@
var/new_sec_level = clamp(text2num(params["new_security_level"]), ACCOUNT_SECURITY_ID, ACCOUNT_SECURITY_PIN)
if(!new_sec_level)
return
var/attempt_pin = input_account_pin(user)
var/attempt_pin = 0
if(user_account.security_level >= ACCOUNT_SECURITY_PIN)
attempt_pin = input_account_pin(user)
if(account_database.try_authenticate_login(user_account, attempt_pin, FALSE, FALSE, FALSE))
user_account.security_level = new_sec_level
to_chat(user, "<span class='notice'>Nanobank: account security set to [new_sec_level == ACCOUNT_SECURITY_ID ? "*Account Number Only*" : "*Require Pin Entry*"]</span>")
else
to_chat(user, "<span class='warning'>Authentification Failure: incorrect pin.</span>")
if("toggle_member_approval")
for(var/datum/station_department/department as anything in SSjobs.station_departments)
if(department.department_account == user_account)