So I am very much so a Ruby and Sinatra novice. I'm in the process of tinkering around with building a small app that utilizes redis-rb for its database.
I am having a lot of difficulty trying to wrap my head around how to accomplish user authentication in a sinatra app.
I've tried looking at various gems such as sinatra-authenticate along with a ton of googling and reading but have come up short when it comes to a simple example that I can just jump into that would work for my purposes.
I wanted to use something such as this: [url removed, login to view] which looks simple enough, however the authorization logic doesn't mesh with accepting a user name and password from a form post since it's outside of the route logic or of course verifying the password via a db.
My overall intention is to use a redis hash with a key that is along the lines of members:users@email to store a users signup information in. Ideally your solution would be conducive to this. (the above email is missing .com due to this site not allowing 'contact' information)
So, I am looking for someone that can:
1. Write me a well commented super simple example of user authentication using sinatra and ideally redis for both authentication (including salted passwords) and to persist a logged in users session. Hopefully simple enough that a route can be protected in a similar manner of the above example.
2. To keep it simple (for me) including an example of the user creation logic that accepts an email, a password, and encrypts the password before entering it into the db. This of course should function with the above auth/session example.