// Check if the request was for creating a new user/group // Redirect it to group info page if ( request.actionType != 'Enter' ) { redirect("grpinfo.htm?formButton=Default"); } // Check if password was entered if ( request.password == '' || request.password == null ) { ShowError("Password field was empty. Please provide a password."); } // Connect to database if ( !ConnectToDatabase() ) { ShowError("Could not connect to database") } // Get the users password. var userQuery = "SELECT loginPassword, groupDescription, groupOwner FROM MecaGroup" userQuery += " WHERE loginName = '" + request.loginName + "'" var userCursor = database.cursor(userQuery) if ( !userCursor.next() ) { ShowError("User does not exist. Please select the \"Create Group\" button on the login page to create a user."); } dbPassword = userCursor.loginPassword userPassword = request.password // Check if the password entered matches the password in the database. if ( dbPassword != userPassword ) { ShowError("Password is incorrect. Please try again.") } // Set client variables client.expiration(1000) client.groupDescription = userCursor.groupDescription client.dateChoice = request.currentDate client.loginName = request.loginName client.loginPassword = request.password client.currentMonth = request.currentMonth client.currentDate = request.currentDate client.currentYear = request.currentYear client.zoneOffset = request.zoneOffset // Check if the logged user/group is a group that can add groups or not. // Only parent groups are allowed to add groups. // addable is a client variable that can be used later on for this // instance of the client. What it means for addable='Y' is that // the groupOwner and the login user is the same. If these two // properties are the same, then the user can add a group. Otherwise, // the user cannot. // // Client.addable can be used throughout the login session within the // server tags in order to determine if the logged in user is the same // as the owner or not. if (request.loginName == userCursor.groupOwner) { client.addable = 'Y' } else { client.addable = 'N' } redirect ("month.htm") // No body