Simple Script

This is another script I wrote because I got bored and wanted to try this out.

Btw, Mods or Admins. Whatever. You should put in the “sleep” method in there. In the beginning. It would make stuff look pretty cool.

Anyways, here it is. It is a LogIn Script. You make a username and a password. The usename must be at least 6 letters long or else you will be forced to retype it in and the password is 8 letters long.

Not the prettiest code.

=begin

Welcome to the basic login system. I don't really feel like commenting on everything just to say how it works but I assume you can figure out how it works.

=end

puts "//////////////////////////////////////"
puts "//      My Basic LogIn System       //"
puts "//////////////////////////////////////"

2.times { puts "" }

sleep 1
puts "Welcome to my basic login system."
puts "I will be asking of you to put in a Username and Password."

2.times { puts "" }

sleep 1.5
puts "Username: "
user = gets.chomp

until user.length > 6 
    1.times { puts "" }
    sleep 1.5
    puts "The Username must be at least 6 values long!"
    1.times { puts "" }
    sleep 1.5
    puts "Username: "
    user = gets.chomp
end

while user.include?(" ")

    2.times { puts "" }
    sleep 1.5
    puts "No spaces please."
    sleep 1.5
    puts "Username: "
    user = gets.chomp
    
end

2.times { puts "" }

sleep 1.5
puts "Password: "
pass = gets.chomp


until pass.length > 8 
    1.times { puts "" }
    sleep 1.5
    puts "The Username must be at least 8 values long!"
    1.times { puts "" }
    sleep 1.5
    puts "Password: "
    pass = gets.chomp
end

while pass.include?(" ")

    2.times { puts "" }
    sleep 1.5
    puts "No spaces please."
    sleep 1.5
    puts "Password: "
    pass = gets.chomp

end

1.times { puts "" }

sleep 1
puts "Saving Information into database."

8.times do
    sleep 1
    print "▊"
end

print "   Done!"


2.times { puts "" }
puts "////LogIn////"
2.times { puts "" }
puts "Username: "
user1 = gets.chomp
until user == user1
    puts ""
    puts "Error: Username does not exist!"
    puts ""
    puts "Username: "
    user1 = gets.chomp
end
1.times { puts "" }
puts "Password: "
pass1 = gets.chomp
until pass == pass1 
    puts ""
    puts "Error: The password is incorrect!"
    puts ""
    puts "Password: "
    pass1 = gets.chomp
end

if user == user1 and pass == pass1
    puts ""
    puts "Congratulations! You are logged in!"
else
    puts ""
    puts "Something went wrong or the passwords are wrong. Please make sure you are typing them in correctly!"
    puts ""
    puts "Username: "
    user1 = gets.chomp
    puts ""
    puts "Password: "
    pass1 = gets.chomp
end

until user == user1 and pass == pass1

    puts ""
    puts "Something went wrong or the passwords are wrong. Please make sure you are typing them in correctly!"
    puts ""
    puts "Username: "
    user1 = gets.chomp
    puts ""
    puts "Password: "
    pass1 = gets.chomp

end

#This is incase someone finds a way around the program or it breaks.


puts "Created By"

puts ""

puts"   ___  _  __     __ "
puts"  / _ \/ |/ /_ __/ /_"
puts" / ___/    / // / __/"
puts"/_/  /_/|_/\_,_/\__/"
puts "PNut"
1 Like

Maybe add hashing? Just a simple exercise.