How to save the state of the application? [closed] - ruby-on-rails

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working on a project in which I'm using oauth to authenticate with peoples stripe account. Part of this process is to send the user off to the stripe website, and then after they log in they are sent back to my application. The problem I'm having is that the stripe authentication is part of a set up process. So I'd like them to return to the place they were before they were sent away, i.e the same page and the state of the form they were in to be the same.
What would be the best way for me to do this, I've thought about saving the form state in the session, the problem with this is it requires a lot of awkward parsing, and can be quite brittle.
Any help would be greatly appreciated.

I'd create a database record before you go to Stripe keying with a GUID and then store the GUID in the session. Then when you come back you can load the database record and recreate whatever you need.

When redirecting the user to the OAuth form on Stripe's site, you can pass a state variable. Stripe will pass back the same variable when redirecting the user back to your return URI.

Related

Implement Remember me using asp mvc [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Sorry I am asking a question that has been asked before but in spite of reading all of them, I am still confused what to do. What exactly I have to do to implement the remember me feature in my website . Is calling the function "setcookie()" alone sufficient
If you are not using identity, then you may need to use cookies for that.
Keep a checkbox in login page for Remember me.
If the checkbox is checked, keep a cookie with some identifier which is in turn stored to the db.
Next time when anyone comes to the login page, check for this cookie identifer in the database and if it exists, login
automatically.
You can read more by doing a quick search on how to remember user using cookies.

Solution for voting without attachment to a model? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
My application is one page contract. I would like users to be able to sign the contract by clicking on a button. The contract is not a resource; it's plain HTML.
Every solution I have found so far relies on having a model that acts as votable. How can I implement a simple button that users may only click once, and display the number of users who have clicked it?
It's not possible to do this with static pages, at least not in a way that is clean and secure.
Think about it this way: every user is looking at a copy of the contract, which is being displayed to them on their browser (the client). If you want users to be able to cast votes that persist and be aware of votes cast by other users, then you need a server that keeps track of it centrally. That's why the solutions you have found so far rely on having a model, presumably backed with a table.

Rails: where to store something global is controlled by controller? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have Users in my app. Each of them has a Facebook profile (Koala is used for this).
So, I should store graph object anywhere. Next I should set facebook id for this graph. I do it from controller because user click "Sign in" and signs in.
Suppose User has friends: I want to get them by user.friends. This method should return facebook ids of user's friends. So, this method should use graph.
How to make all of this correct?
Hm... If I understood you correctly, you want to create and store global #graph object per User after he signs in. I think, we meet here with stateless property of HTTP protocol and one way to avoid it - using Rails session object. But this is wrong way in my mind.
Another way - create #graph every time after User signs in. And another way - using something middleware machinery, like Redis. You can store in Redis any information about User in string. For example, you can store in it set of User Facebook friends and get them any time you need.
But surely there is another way, I think )

iOS App auto create account on web service [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I Was wondering if anyone can tell me if this is possible. So.. I am just about to create my first iPhone app. I have my idea and everything is sketched out etc.. but then today I realised that I had not thought about all the features and their implementation properly. This could soon be a no win situation, so please help
Is it possible to create a username and password automatically upon first app opening? so the username and password is to be generated on the fly and then submitted to a web database.
I would also like it so that the user of the app could change this manually if they wished. but also so that if they viewed it on their other iDevices they could sync it up.
Is that possible?
yes, you could generate a random string to sign up a user for first time (backdoor guest account sort of speak), I've done it with one of my apps before (temporarily). However, you should consider baking a guest account feature into your remote server.

When should I implement my authentication scheme? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am definitely going to use an authentication scheme (Devise) with 3 roles: user, admin & sponsor. The question is: should I implement authentication right away or wait until I have my other models/views in place first?
I think it is usefull to do it as first, so you can easely integrate them in other models, eg. log that a user does something, you will also be able to set weather a user should have access to a specific controller.
Unless, you have a good reason to not do it...
A rather unexpected question, but you can safely create your authentication routine right away. In any project i create, authentication is definitely one of the first things i code, most times using Sorcery instead of Devise.
IMO it doesn't really matter, but why not do it earlier than later? It's pre-built, allows early testing (and testing it often), and allows access control needs to evolve organically rather than waiting until they all pile up and you have to do it all at once.

Resources