From 03a06fa877f1347a08470473901ce02a87314392 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sat, 30 Jun 2012 16:24:49 -0400 Subject: [PATCH] New user app replacement example --- scripts/apply_sample.mps | 96 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 scripts/apply_sample.mps diff --git a/scripts/apply_sample.mps b/scripts/apply_sample.mps new file mode 100644 index 0000000..1e7016e --- /dev/null +++ b/scripts/apply_sample.mps @@ -0,0 +1,96 @@ +// ========================================================================== +// NEWUSERAPP.MPS : Sample new user process MPL program +// +// If newuserapp.mpx exists in the theme's script directory, it will be ran +// instead of the normal New User process. You must make sure you scan for +// duplicate user names, and other things like that which the BBS would +// normally do during this process. At the start of the program, you must +// call GetThisUser to load the new user data into the USER variables. +// Before exiting the program, you must call PutThisUser to store the USER +// variables back into the new user data. +// +// Note: To use this program, you must rename it to newuserapp.mps and +// compile it with MIDE or MPLC. +// ========================================================================== + +Uses + User + +Procedure GetAlias; +Var + Str : String[30]; +Begin + Repeat + Write ('Enter your alias: '); + + Str := StripLow(StripB(Input(30, 30, 11, ''), ' ')); + + If IsUser(Str) Then + WriteLn ('Account already exists') + Else + Break; + Until False; + + UserAlias := Str; +End; + +Procedure GetRealName; +Var + Str : String[30]; +Begin + Repeat + Write ('Enter your real name: '); + + Str := StripLow(StripB(Input(30, 30, 11, ''), ' ')); + + If Pos(' ', Str) = 0 Then + WriteLn ('Enter first AND last name') + Else + If IsUser(Str) Then + WriteLn ('Account already exists') + Else + Break; + Until False; + + UserName := Str; +End; + +Procedure GetPassword; +Var + Str1 : String[20]; + Str2 : String[20]; +Begin + Repeat + Repeat + Write ('Enter your password: '); + + Str1 := Input(20, 20, 16, ''); + + If Length(Str1) < 4 Then + WriteLn ('Password must be at least 4 chars') + Else + Break; + Until False; + + Write ('Verify your password: '); + + Str2 := Input(20, 20, 16, ''); + + If Str1 <> Str2 Then + WriteLn ('Passwords do not match.') + Else + Break; + Until False; + + UserPassword := Str1; +End; + +Begin + GetThisUser; + + GetAlias; + GetRealName; + GetPassword; + + PutThisUser; +End.