#263 New auth menus. Allow saving keys without setting password
This commit is contained in:
+2
-2
@@ -7388,9 +7388,9 @@ docremark ["authsetup genpriv" - generates private key from prepriv key.];
|
||||
|
||||
docremark ["authsetup genpub" - generates public key from private key.];
|
||||
|
||||
docremark ["authsetup newppass preprivpass [preprivfilename]" - encrypts prepriv key with new password and saves the result to file. The default filename is config/authpreprivate.cfg and an existing file gets overwritten - but the former file content is kept and also written, each line commented out.];
|
||||
docremark ["authsetup newppass preprivpass [preprivfilename]" - encrypts prepriv key with new password and saves the result to file. The default filename is private/authpreprivate.cfg and an existing file gets overwritten - but the former file content is kept and also written, each line commented out.];
|
||||
|
||||
docremark ["authsetup newpass privpass [privatefilename]" - encrypts private key with new password and saves the encrypted private key and the public key to file. The default filename is config/authprivate.cfg and an existing file gets overwritten - but the former file content is kept and also written, each line commented out.];
|
||||
docremark ["authsetup newpass privpass [privatefilename]" - encrypts private key with new password and saves the encrypted private key and the public key to file. The default filename is private/authprivate.cfg and an existing file gets overwritten - but the former file content is kept and also written, each line commented out.];
|
||||
|
||||
docremark ["authsetup unarmed" - sets private and public keys to a fixed value. For testing only. Can be used to "log out".];
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ exec config/menus_bot.cfg
|
||||
exec config/menus_edit.cfg
|
||||
exec config/menus_licenses.cfg
|
||||
exec config/menus_settings.cfg
|
||||
exec config/menus_auth.cfg
|
||||
exec config/menus_multiplayer.cfg
|
||||
exec config/menus_voicecom.cfg
|
||||
exec config/favourites.cfg
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
newmenu [Auth Setup]
|
||||
menuinit [ tempalias ___ppass "" ; tempalias ___pass ""; tempalias ___rememberpass 0; ]
|
||||
menuitem "To play online you need to create a game account which will be used" -1
|
||||
menuitem "identify you to game servers. This identity is stored as a public/private" -1
|
||||
menuitem "keypair and only the public key is ever transmitted to the server. You are" -1
|
||||
menuitem "able to change the password at a future point in time." -1
|
||||
menuitem "" -1
|
||||
menuitem "There exists a mechanism to recover your identity if lost that uses a" -1
|
||||
menuitem "seperate password." -1
|
||||
menuitem "" -1
|
||||
menuitem "To learn more about this functionality you can go to this URL in your browser" -1
|
||||
menuitem "\f1https://assault.cubers.net/docs/auth.html" -1
|
||||
menuitem "" -1
|
||||
menuitem "\f0Set passwords \f4(recommended)"
|
||||
menuitemtextinput "Password for your game account\t" "" [___pass = $arg1] [] 64
|
||||
menuitemtextinput "Password for account restoration\t" "" [___ppass = $arg1] [] 64
|
||||
menuitem "" -1
|
||||
menuitemradio "Remember game account password: " 0 1 [ ] [ "No \f4(recommended)" "Yes"] [ ___rememberpass = (= $arg1 1)]
|
||||
menuitem "\f2\t\t\t [ OK ]" [
|
||||
// if (strcmp $___ppass "") [ ___ppass = "unppass" ] []
|
||||
// if (strcmp $___pass "") [ ___pass = "unpass" ] []
|
||||
authsetup genpre
|
||||
authsetup genpriv
|
||||
authsetup genpub
|
||||
if (= $___rememberpass 1) [ alias savedpass $___pass ] [ if (checkalias savedpass) [ delalias savedpass ] ]
|
||||
|
||||
closecurmenu
|
||||
showmenu "Auth Progress"
|
||||
]
|
||||
|
||||
|
||||
newmenu "game account"
|
||||
menuitem "To play online you need to create a game account first." -1
|
||||
menuitem "" -1
|
||||
menuitem "\t\t\f0[Create game account]" [ closecurmenu; showmenu "Auth Setup"; ]
|
||||
menuitem "\t\t[Not now...]" closecurmenu
|
||||
|
||||
newmenu "Auth Progress"
|
||||
menuinit [ sleep 100 [
|
||||
if (strcmp $___ppass "") [ authsetup savepre ] [ authsetup newppass $__ppass; authsetup savepre ]
|
||||
if (strcmp $___pass "") [ authsetup savepriv ] [ authsetup newpass $___pass; authsetup savepriv ]
|
||||
___ppass = ""
|
||||
___pass = ""
|
||||
if (authsetup) [ echo "\f0created game account" ]
|
||||
closecurmenu
|
||||
checkaccount
|
||||
] ]
|
||||
menuitem "Please wait while we create your account..." -1
|
||||
|
||||
newmenu "enter password"
|
||||
menuitemtextinput "please enter the password for your game account\t" "" [ __loginpass = $arg1; closecurmenu; showmenu authentication ] [] 64 1
|
||||
|
||||
newmenu "authentication"
|
||||
menuinit [ sleep 100 [ echo "checking..." ; authsetup passd $__loginpass authfinish; __loginpass = "" ] ]
|
||||
menuitem "Please wait while we authenticate your game account..." -1
|
||||
|
||||
const authfinish [
|
||||
closecurmenu
|
||||
if (authsetup) [
|
||||
echo "\f0authentication successful"
|
||||
] [
|
||||
echo "\f3authentication failed, please enter the correct password for your game account"
|
||||
]
|
||||
]
|
||||
|
||||
// try to authenticate the game account or offer to create a new game account if none exists
|
||||
// set $arg1 to 1 to enable silent mode to prevent any user interactions
|
||||
const checkaccount [
|
||||
if (authsetup) [] [
|
||||
if (authsetup needpass) [] [
|
||||
// load the password protected private key
|
||||
exec private/authprivate.cfg
|
||||
]
|
||||
if (authsetup needpass) [
|
||||
if (checkalias savedpass) [
|
||||
// try the saved password if there is one
|
||||
authsetup passd $savedpass
|
||||
] [
|
||||
// saved password does not exist so ask for password
|
||||
if (= $arg1 0) [ showmenu "enter password" ]
|
||||
]
|
||||
] [
|
||||
// game account does not seem to be set up, ask user to create new game account
|
||||
if (= $arg1 0) [ showmenu "game account" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -172,7 +172,7 @@ menuitem [Join a LAN server] [ ifauthsetup joinlanservermenu ]
|
||||
menuitem [Custom connect] [ ifauthsetup customconnectmenu ]
|
||||
menuitem [Connect as Admin] [ ifauthsetup adminconnectmenu ]
|
||||
menuitem [] -1
|
||||
menuitem [Reset game account] [ showmenu [create game account] ]
|
||||
menuitem [Reset game account] [ showmenu [Auth Setup] ]
|
||||
menuitem [Force serverlist update] [ updatefrommaster 1; ifauthsetup joinservermenu ]
|
||||
|
||||
//// Main > Multiplayer > Custom connect ////
|
||||
@@ -330,83 +330,4 @@ menuinit [
|
||||
menuitem "\f2 [ Download the servers map version and join the game ]" [ getmap ]
|
||||
menuitem "\f3 [ Keep the local map version and disconnect from the server ]" [ showmenu ""; disconnect ]
|
||||
menuinitselection 4
|
||||
]
|
||||
|
||||
// game account management menus
|
||||
|
||||
newmenu "game account"
|
||||
menuitem "To play online you need to create a game account first." -1
|
||||
menuitem "" -1
|
||||
menuitem "\t\t\f0[Create game account]" [ closecurmenu; showmenu "create game account"; ]
|
||||
menuitem "\t\t[Not now...]" closecurmenu
|
||||
|
||||
newmenu "create game account"
|
||||
menuinit [ tempalias ___ppass "" ; tempalias ___pass ""; tempalias ___rememberpass 0; ]
|
||||
menuitemtextinput "Please enter a password for account restoration\t" "" [___ppass = $arg1] [] 64
|
||||
menuitemtextinput "Please enter a password for your game account\t" "" [___pass = $arg1] [] 64
|
||||
menuitem "" -1
|
||||
menuitemradio "Remember game account password: " 0 1 [ ] [ "No (recommended)" "Yes"] [ ___rememberpass = (= $arg1 1)]
|
||||
menuitem "" -1
|
||||
menuitem "\t\t\f0[Ok]" [
|
||||
if (strcmp $___ppass "") [ menuselection (curmenu) 0; -1 ] [
|
||||
if (strcmp $___pass "") [ menuselection (curmenu) 1; -1 ] [
|
||||
authsetup genpre
|
||||
authsetup genpriv
|
||||
authsetup genpub
|
||||
if (= $___rememberpass 1) [ alias savedpass $___pass ] [ if (checkalias savedpass) [ delalias savedpass ] ]
|
||||
closecurmenu
|
||||
showmenu "progress"
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
newmenu "progress"
|
||||
menuinit [ sleep 100 [
|
||||
authsetup newppass $___ppass
|
||||
authsetup newpass $___pass
|
||||
___ppass = ""
|
||||
___pass = ""
|
||||
if (authsetup) [ echo "\f0created game account" ]
|
||||
closecurmenu
|
||||
checkaccount
|
||||
] ]
|
||||
menuitem "Please wait while we create your account..." -1
|
||||
|
||||
newmenu "enter password"
|
||||
menuitemtextinput "please enter the password for your game account\t" "" [ __loginpass = $arg1; closecurmenu; showmenu authentication ] [] 64 1
|
||||
|
||||
newmenu "authentication"
|
||||
menuinit [ sleep 100 [ echo "checking..." ; authsetup passd $__loginpass authfinish; __loginpass = "" ] ]
|
||||
menuitem "Please wait while we authenticate your game account..." -1
|
||||
|
||||
const authfinish [
|
||||
closecurmenu
|
||||
if (authsetup) [
|
||||
echo "\f0authentication successful"
|
||||
] [
|
||||
echo "\f3authentication failed, please enter the correct password for your game account"
|
||||
]
|
||||
]
|
||||
|
||||
// try to authenticate the game account or offer to create a new game account if none exists
|
||||
// set $arg1 to 1 to enable silent mode to prevent any user interactions
|
||||
const checkaccount [
|
||||
if (authsetup) [] [
|
||||
if (authsetup needpass) [] [
|
||||
// load the password protected private key
|
||||
exec config/authprivate.cfg
|
||||
]
|
||||
if (authsetup needpass) [
|
||||
if (checkalias savedpass) [
|
||||
// try the saved password if there is one
|
||||
authsetup passd $savedpass
|
||||
] [
|
||||
// saved password does not exist so ask for password
|
||||
if (= $arg1 0) [ showmenu "enter password" ]
|
||||
]
|
||||
] [
|
||||
// game account does not seem to be set up, ask user to create new game account
|
||||
if (= $arg1 0) [ showmenu "game account" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
@@ -706,8 +706,8 @@ menuitemslider "Graphics detail: " 1 6 "$gfxqualityalias" [Horrible Low Mediu
|
||||
menuitemslider "Sound detail: " 1 3 "$__soundquality" [Low Medium High] [ __set_sound_quality $arg1 ]
|
||||
menuitemslider "Field of view: " 75 120 "$fov" 2 [ fov $arg1 ] 1
|
||||
menuitem "" -1
|
||||
menuitem "\f0\t\t\t [ OK; View FAQ ]" [ closecurmenu; resetgl; load_faq ; showmenu faq ]
|
||||
menuitem "\f2\t\t\t [ OK ]" [ closecurmenu; resetgl ]
|
||||
menuitem "\f0\t\t\t [ View FAQ ]" [ load_faq ; showmenu faq ]
|
||||
menuitem "\f2\t\t\t [ OK ]" [ closecurmenu; resetgl; showmenu [Auth Setup] ]
|
||||
|
||||
const new_gfx_quality [
|
||||
if (= $arg1 6) [ // "INSANE!" gfx quality
|
||||
|
||||
+11
-4
@@ -922,8 +922,6 @@ void authsetup(char **args, int numargs) // set up private and public keys
|
||||
preprivpwdcfg = (iterations << 10) | authmemusage;
|
||||
xor_block(prepriv, keyhash, preprivlen);
|
||||
}
|
||||
savepreprivkey(numargs > 2 && args[2][0] ? path(args[2]) : AUTHPREPRIVATECFGFILE
|
||||
, prepriv, preprivlen, psalt, preprivpwdcfg);
|
||||
}
|
||||
}
|
||||
else if(!strcasecmp(args[0], "NEWPASS"))
|
||||
@@ -940,10 +938,19 @@ void authsetup(char **args, int numargs) // set up private and public keys
|
||||
privpwdcfg = (iterations << 10) | authmemusage;
|
||||
xor_block(priv, keyhash, 32);
|
||||
}
|
||||
saveprivkey(numargs > 2 && args[2][0] ? path(args[2]) : AUTHPRIVATECFGFILE,
|
||||
priv, keyhash + 32, salt, privpwdcfg);
|
||||
}
|
||||
}
|
||||
else if(!strcasecmp(args[0], "SAVEPRIV"))
|
||||
{
|
||||
ed25519_pubkey_from_private(keyhash + 32, priv);
|
||||
saveprivkey(numargs > 2 && args[2][0] ? path(args[2]) : AUTHPRIVATECFGFILE,
|
||||
priv, keyhash + 32, salt, privpwdcfg);
|
||||
}
|
||||
else if(!strcasecmp(args[0], "SAVEPRE"))
|
||||
{
|
||||
savepreprivkey(numargs > 2 && args[2][0] ? path(args[2]) : AUTHPREPRIVATECFGFILE,
|
||||
prepriv, preprivlen, psalt, preprivpwdcfg);
|
||||
}
|
||||
#ifndef PRODUCTION
|
||||
else if(!strcasecmp(args[0], "UNARMED")) // FIXME: this is for testing purposes only - to test simultaneous logins from the same account - delete before release!
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user