I’ve tried a few things but can’t seem to get my head round it. I’ve been practicing and know how to do this using email but how can I do it using username?
def self.authenticate(username, password)
user = find_by_name(username)
if user && user.password_hash == BCrypt::Engine.hash_secret(password, user.password_salt)
user
else
nil
end
end
Change
to