Refactor checking if a codename is valid
Refactor checking if a codename is valid

Checks the database instead of the filesystem to continue working toward
unifying the data model in the database.

Simplifies top-level flow for valid_codename and encapsulates any
internal errors that might occur within valid_codename instead of in the
caller.

Adds logging for failed logins.

pwplus/securedrop,jeann2013/securedrop,ageis/securedrop,pwplus/securedrop,GabeIsman/securedrop,kelcecil/securedrop,GabeIsman/securedrop,micahflee/securedrop,GabeIsman/securedrop,ageis/securedrop,chadmiller/securedrop,jrosco/securedrop,ageis/securedrop,pwplus/securedrop,jaseg/securedrop,garrettr/securedrop,chadmiller/securedrop,jeann2013/securedrop,garrettr/securedrop,jaseg/securedrop,conorsch/securedrop,pwplus/securedrop,jrosco/securedrop,jaseg/securedrop,heartsucker/securedrop,kelcecil/securedrop,GabeIsman/securedrop,chadmiller/securedrop,ehartsuyker/securedrop,ehartsuyker/securedrop,heartsucker/securedrop,kelcecil/securedrop,kelcecil/securedrop,conorsch/securedrop,chadmiller/securedrop,ehartsuyker/securedrop,pwplus/securedrop,jrosco/securedrop,micahflee/securedrop,jrosco/securedrop,jrosco/securedrop,heartsucker/securedrop,pwplus/securedrop,kelcecil/securedrop,micahflee/securedrop,jeann2013/securedrop,jaseg/securedrop,conorsch/securedrop,heartsucker/securedrop,chadmiller/securedrop,jrosco/securedrop,conorsch/securedrop,jeann2013/securedrop,GabeIsman/securedrop,micahflee/securedrop,ehartsuyker/securedrop,jaseg/securedrop,jeann2013/securedrop,ageis/securedrop,heartsucker/securedrop,conorsch/securedrop,ehartsuyker/securedrop,ehartsuyker/securedrop,garrettr/securedrop,GabeIsman/securedrop,jeann2013/securedrop,chadmiller/securedrop,jaseg/securedrop,garrettr/securedrop,kelcecil/securedrop