-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathLoginBugFix.rb
More file actions
29 lines (22 loc) · 1 KB
/
LoginBugFix.rb
File metadata and controls
29 lines (22 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
=begin
Oh NO! Timmy has moved divisions... but now he's in the field of security.
Timmy being the top coder he is has allowed some bad code through, you must help
Timmy and filter out any injected code!
Task
Your task is simple, search the password string for any injected code (Injected
code is any thing that would be used to exploit flaws in the current code, so
basically anything that contains || or //) if you find any you must return
"Wrong username or password!" because no one likes someone trying to cheat their
way in!
Preloaded
You will be given a preloaded class called Database with a method login this
takes two parameters username and password. This is a generic login function
which will check the database for the user it will return either 'Successfully
Logged in!' if it passes the test or 'Wrong username or password!' if either the
password is wrong or username does not exist.
=end
# My Solution
def validate(username, password)
validator = Validator.new
validator.login(username, password)
end