[Ruby] Login concept 04-09-2015, 11:53 PM
#1
Not sure what I'd use this for but I made a login system using some mechanics I learned ages ago in new ways. If you think of some cool ideas to use this, let me know.
Code:
#Login service concept by Touka, ©2015
puts "Select action:
[1] Create Account
[2] Login"
act = gets.chomp
system "cls"
case act
when "1"
puts "Set Username: "
user = gets.chomp
system "cls"
puts "Set Password: "
pass = gets.chomp
p1 = pass[0]
pend = pass[-1]
system "cls"
puts "Username: #{user}
Password: #{p1}▓▓▓▓▓▓#{pend}
Correct? (y/n): "
confirm = gets.chomp
confirm.downcase!
if confirm == "y"
if Dir.exist?("users")
x = x
else
Dir.mkdir("users")
end
File.new("users\\#{user}Creds.rln", "w")
File.open("users\\#{user}Creds.rln", "w") {|f| f.write("#{user} : #{pass}")}
else
exit
end
when "2"
def login
system "cls"
puts "Enter Username:"
user = gets.chomp
system "cls"
puts "Enter Password:"
pass = gets.chomp
comp = "#{user} : #{pass}"
system "cls"
file = File.open("users\\#{user}Creds.rln")
passcheck = file.read
if comp == passcheck
puts "Login successful."
sleep
else
puts "Username or Password incorrect."
kden = gets
login
end
end
login
endIt's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.

















![[+]](https://sinister.li/images/modern/collapse_collapsed.png)