Simplify the return values when using basic auth

Returning a hash with explicit keys isn't strictly necessary with the
access methods we're using to get the values for those keys out of the
hash. Return an empty hash instead, simplifying the code.

Also remove the early return statements within the conditional. Those
are also unneeded since this is the last expression that's run in the
method.
This commit is contained in:
Matt Rogers 2015-11-02 22:05:29 -06:00
parent fbb62fd36e
commit d9b78c4e1f

View file

@ -195,15 +195,12 @@ module LoginSystem
end end
if authdata and authdata[0] == 'Basic' if authdata and authdata[0] == 'Basic'
data = Base64.decode64(authdata[1]).split(':')[0..1] data = Base64.decode64(authdata[1]).split(':')[0..1]
return { {
user: data[0], user: data[0],
pass: data[1] pass: data[1]
} }
else else
return { {}
user: ''.freeze,
pass: ''.freeze
}
end end
end end