Are you sure for rows.Next() is returning true in router.go? Usually there 
is a call to rows.Error() after the iteration too.

Matt

On Thursday, December 7, 2017 at 11:33:53 AM UTC-6, Gabriel Simmer wrote:
>
> So after much looking, I've concluded it's not an issue with the database 
> encoding. What's odd is if I manually add the hash to the database it 
> functions fine.
>
> On Tuesday, December 5, 2017 at 11:39:38 AM UTC-8, Gabriel Simmer wrote:
>>
>> Hey Gophers,
>>
>> I have a bit of a headscratcher for you guys today, hoping someone will 
>> be able to help me track down where I've gone wrong. I have an SQLite3 
>> database with user login info, including username, hashed password w/ 
>> bcrypt, and so on. I also have a "setup" method that is triggered on the 
>> first run of the application, which includes creating the database, setting 
>> an admin password and fetching assets. There's one hitch - the hashed 
>> password doesn't seem to be either:
>>
>>  - Stored properly
>>  - Hashed properly
>>  - Compared properly
>>
>> I've done some extensive testing and it appears bcrypt *is* hashing the 
>> password, and I can compare it successfully right after, and before I put 
>> it into the database. All good. However when I pull the hash from the 
>> database later (on user login), bcrypt doesn't see the hash and the 
>> password as equal and errors out. 
>>
>> Here is the GitHub repository's branch 
>> <https://github.com/gmemstr/pogo/tree/setup>, if you want to fully test 
>> the application, but the relevant files are setup.go 
>> <https://github.com/gmemstr/pogo/blob/setup/setup.go#L38-L56> and 
>> router/router.go 
>> <https://github.com/gmemstr/pogo/blob/setup/router/router.go#L125-L207>. 
>> I've left in some debugging checks, and will happily answer any questions I 
>> haven't clarified. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to