menus_auth.cfg 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. newmenu [auth setup]
  2. menuinit [ menuselection (curmenu) 8; tempalias ___ppass "" ; tempalias ___pass ""; tempalias ___rememberpass 0; ]
  3. menuitem "To play online you need to create an account" -1
  4. menuitem "which servers will use to identify you." -1
  5. menuitem "This identity is stored as a public/private keypair." -1
  6. menuitem "\f5Keep the \f2private key \f3private\f5!" -1
  7. menuitem "You can change the unlock password at any time." -1
  8. menuitem "You can NOT change the master password. Ever." -1
  9. menuitem "" -1
  10. //TODO: auth.html does not exist and the procedure does not exist
  11. //menuitem "The way to recover a lost identity uses" -1
  12. //menuitem "a seperate and unchangeable password." -1
  13. //menuitem "" -1
  14. //menuitem "To learn more about this functionality you can go to this URL in your browser" -1
  15. //menuitem "\f1https://assault.cubers.net/docs/auth.html" -1
  16. //menuitem "" -1
  17. //ABOUT: the master password was advertised as 'password for account restoration'
  18. menuitem "\f0Set passwords \f4(recommended)" -1
  19. menuitemtextinput "Unlock password\t" "" [___pass = $arg1] [] 64 1
  20. menuitemtextinput "Master password\t" "" [___ppass = $arg1] [] 64 1
  21. menuitem "\fHhold CTRL key to view password input in the clear" -1
  22. menuitem "" -1
  23. menuitemradio "Remember game account password: " 0 1 [ ] [ "No \f4(recommended)" "Yes"] [ ___rememberpass = (= $arg1 1)]
  24. menuitem "\f2\t\t\t [ OK ]" [
  25. authsetup genpre
  26. authsetup genpriv
  27. authsetup genpub
  28. if (= $___rememberpass 1) [ alias savedpass $___pass ] [ if (checkalias savedpass) [ delalias savedpass ] ]
  29. closecurmenu
  30. showmenu "auth setup progress"
  31. ]
  32. newmenu "auth setup progress"
  33. menuinit [ sleep 100 [
  34. if (strcmp $___ppass "") [ authsetup savepre ] [ authsetup newppass $___ppass; authsetup savepre ]
  35. if (strcmp $___pass "") [ authsetup savepriv ] [ authsetup newpass $___pass ]
  36. ___ppass = ""
  37. ___pass = ""
  38. if (authsetup) [ echo "\f0created game account" ]
  39. closecurmenu
  40. checkaccount
  41. ] ]
  42. menuitem "Please wait while we create your account..." -1
  43. newmenu [auth password change]
  44. menuinit [ tempalias ___pass ""; tempalias ___rememberpass 0; ]
  45. menuitem "Please choose a new password for your private key" -1
  46. menuitem "" -1
  47. menuitemtextinput "Password for your game account\t" "" [___pass = $arg1] [] 64
  48. menuitemradio "Remember game account password: " 0 1 [ ] [ "No \f4(recommended)" "Yes"] [ ___rememberpass = (= $arg1 1)]
  49. menuitem "\f2[ Set Password ]" [
  50. if (= $___rememberpass 1) [ alias savedpass $___pass ] [ if (checkalias savedpass) [ delalias savedpass ] ]
  51. closecurmenu
  52. showmenu "auth password change progress"
  53. ]
  54. menuitem "\f7[ Cancel ]" closecurmenu
  55. newmenu "auth password change progress"
  56. menuinit [ sleep 100 [
  57. if (strcmp $___pass "") [ ] [ authsetup newpass $___pass ]
  58. ___pass = ""
  59. if (authsetup) [ echo "\f0updated game account" ]
  60. closecurmenu
  61. checkaccount
  62. ] ]
  63. menuitem "Please wait while we update your account..." -1
  64. newmenu [auth]
  65. menuinit [
  66. resetcurmenu
  67. tempalias ___pass ""; tempalias ___rememberpass 0;
  68. if (authsetup) [
  69. menuitem "\f0Pub key:" -1
  70. menuitem (format "\fY%1" (mypubkey)) -1
  71. menuitem "\f2[ Copy to clipboard ]" [setclipboardtext (mypubkey)]
  72. menuitem "" -1
  73. menuitem "\f0Change Password" -1
  74. menuitemtextinput "New password" "" [___pass = $arg1] [] 64
  75. menuitemradio "Remember game account password: " 0 1 [ ] [ "No \f4(recommended)" "Yes"] [ ___rememberpass = (= $arg1 1)]
  76. menuitem "\f2[ Update Password ]" [
  77. if (= $___rememberpass 1) [ alias savedpass $___pass ] [ if (checkalias savedpass) [ delalias savedpass ] ]
  78. closecurmenu
  79. showmenu "auth password change progress"
  80. ]
  81. menuitem "" -1
  82. menuitem "\f3[ Reset auth ]" [ showmenu [auth setup]]
  83. ] [
  84. if (authsetup needpass) [
  85. menuitem "\f3Password required to authenticate \f2[ Enter password ]" [ showmenu [enter password]]
  86. menuitem "" -1
  87. menuitem "\f3[ Reset Auth ]" [ showmenu [auth setup] ]
  88. ] [
  89. menuitem "\f3Auth not setup" -1
  90. menuitem "\f2[ Setup Auth ]" [ showmenu [auth setup] ]
  91. ]
  92. ]
  93. ]
  94. newmenu "game account"
  95. menuitem "To play online you need to create a game account first." -1
  96. menuitem "" -1
  97. menuitem "\t\t\f0[Create game account]" [ closecurmenu; showmenu "auth setup"; ]
  98. menuitem "\t\t[Not now...]" closecurmenu
  99. __passwordfirstitem = 0
  100. newmenu "enter password"
  101. menuinit [ menuselection (curmenu) $__passwordfirstitem ]
  102. menuitemtextinput "please enter the password for your game account\t" "" [ __passwordfirstitem = 2; __loginpass = $arg1; closecurmenu; showmenu authentication ] [] 64 1
  103. menuitem "\fHhold CTRL key to view password input in the clear" -1
  104. menuitem "[Not now...]" [ closemenu "" ]
  105. newmenu "authentication"
  106. menuinit [ sleep 100 [ echo "checking..." ; authsetup passd $__loginpass authfinish; __loginpass = "" ] ]
  107. menuitem "Please wait while we authenticate your game account..." -1
  108. const authfinish [
  109. closecurmenu
  110. if (authsetup) [
  111. echo "\f0authentication successful"
  112. ] [
  113. echo "\f3authentication failed, please enter the correct password for your game account"
  114. ]
  115. ]
  116. // try to authenticate the game account or offer to create a new game account if none exists
  117. // set $arg1 to 1 to enable silent mode to prevent any user interactions
  118. const checkaccount [
  119. if (authsetup) [] [
  120. if (authsetup needpass) [] [
  121. // load the password protected private key
  122. exec private/authprivate.cfg
  123. ]
  124. if (authsetup needpass) [
  125. if (checkalias savedpass) [
  126. // try the saved password if there is one
  127. authsetup passd $savedpass
  128. ] [
  129. // saved password does not exist so ask for password
  130. if (= $arg1 0) [ showmenu "enter password" ]
  131. ]
  132. ] [
  133. // game account does not seem to be set up, ask user to create new game account
  134. if (= $arg1 0) [ showmenu "game account" ]
  135. ]
  136. ]
  137. ]