Make DB admin ranks more useful (#29906)

* Make DB admin ranks more useful

* Avoid error message when cancelling permission toggle, allow adding localhost admins as real admins.

* Lint.

* Don't SQL error when a previously-unseen player connects.

* Use ckey of permission editor, not mob name.

* Strikethrough

* Order in the list.

* Deadmin, readmin, and 2fa.

* Correct merge error

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Charlie Nolan
2025-08-10 12:05:19 +01:00
committed by GitHub
co-authored by Burzah
parent f67dd166cb
commit 2b98749d32
20 changed files with 1037 additions and 469 deletions
+13 -1
View File
@@ -55,12 +55,15 @@
return
// If we are here, they authed successfully
alert(usr, "Congratulations. 2FA is now setup properly for your account. In preferences, you can change whether you want it to ask for a code on every connection or only when your IP changes")
B.close()
// Default to IP change only
prefs._2fa_status = _2FA_ENABLED_IP
prefs.save_preferences(src)
prefs.ShowChoices(usr)
if(holder && holder.restricted_by_2fa)
reload_one_admin(ckey)
to_chat(usr, "<span class='notice'>2fa configured, admin verbs enabled.")
alert(usr, "Congratulations. 2FA is now setup properly for your account. In preferences, you can change whether you want it to ask for a code on every connection or only when your IP changes")
return
@@ -79,6 +82,10 @@
var/confirm = tgui_alert(usr, "Are you SURE you want to deactivate 2FA?", "WARNING", list("Yes", "No"))
if(confirm != "Yes")
return
if(holder && holder.needs_2fa())
confirm = tgui_alert(usr, "This will disable most of your admin permissions. Are you REALLY sure?", "WARNING", list("Yes", "No"))
if(confirm != "Yes")
return
// Prompt them for a code to make sure they know what they are doing
var/entered_code = input(usr, "Please enter a code from your auth app", "2FA Validation")
@@ -106,8 +113,13 @@
prefs._2fa_status = _2FA_DISABLED
prefs.save_preferences(src)
prefs.ShowChoices(usr)
if(holder && holder.needs_2fa())
reload_one_admin(ckey)
alert(usr, "2FA disabled successfully")
/client/proc/has_2fa()
return prefs._2fa_status != _2FA_DISABLED
/datum/preferences/proc/_2fastatus_to_text()
switch(_2fa_status)
if(_2FA_DISABLED)