I am working on a web application where many people are supposed to connect and one is going to act as an admin. The users can only proceed to the next stage if the admin has allowed the access.
At the moment, I am wondering how should I realize the access control.
In the first version, I was doing an ajax get request when a user clicks the next button, and then if a specific word is present, I proceed. The admin was supposed to modify the page manually. Now I would like to automate it and make it more user-friendly (as the admin does not go to the code manually modifying).
My idea is, there is going to be radio boxes which by clicking, the admin can allow or disallow access. However, to achieve this, my idea was to make an ajax post request to the server when admin selects one and then modifying some keyword in a hidden page. Is this approach feasible or am I completely wrong?
Thank you for your time.
Does the users login first to proceed e.g how they access the system ? A user whom access you wanted to restrict must have something unique associated to it. And you can have his/her data updated upon access update through radio buttons. Any particular user connects to the system only his/her access rights are checked into the system
Okay, so I found a solution to my problem.
First, the hidden page which is only used as a "signal" telling if the users can proceed, renders yes or no. When the Admin selects yes/no radio button, then the app does an ajax post request to my server, saves the value and renders the hidden page with it.
Related
I have a question, obviously. Actually, I am creating two webpages using HTML, out of which, first one will be a Login Form Page, and if the user will enter correct username and password on this page, he/she will be redirected to the second Welcome User webpage.
Since there are two webpages, there will be two different domains, suppose first one is login.com and second is welcome.com. Now, I want the user to first go to login.com and then enter the username and password then, finally, he will be able to access welcome.com. But here's the problem is, if the user will go directly to welcome.com, he will be able to access his account without logging in. So, I want to know if there is a way through which if the user will directly go to welcome.com, JavaScript will verify (maybe, by using
windows.onload) if user is coming from login.com or directly. If user will be coming directly, the webpage will show error, and if coming after logging in(or from login.com page), user will be welcomed. So, please tell me, is there any way to do this? Thanks in Advance... Any help would be appreciated...
I am currently redesigning a website and looking for a solution on how to add a paid version of the site.
For example, say I have a <select> drop-down box with 20 elements inside. However, I want 15 of these 20 elements to be disabled unless the user has a paid account. At this time, that is the extent of what I need to differentiate between free/paid versions.
I'm planning on adding the ability to register an account and log in, as well as some type of payment processor (recommendations are appreciated for this! - currently looking at using Django/Python). I just don't know how to best go about managing two different levels of the website, and allowing those additional options to paid members.
I'm working with calculators that are pure Javascript. Using Bootstrap for the page design. As far as anything else goes, I'm open.
To do that, you'd have to add a field with a default value of NULL to your database, let's call it "subscription", into your users table. Then, everytime a user login to your website, fetch the subcription value and write it into a session variable. The last thing you have to do to ensure free members aren't allowed to perform any actions the subscribed members can is checking the content of the session variable while :
building your html, or you could check it on the client side with javascript right after the premium element has loaded (this is for user experience only since a client can remove any html attribute whnever they want)
and
while recieving the data of the premium element on the server side, accept it if the user is premium, reject it if they're free (again, just checking the session variable should do the job).
So as you can see, it's much more about preventing free users to gain access at the paid members options than allowing paid members to browse a completly new version of the website designed specifically for them.
I will try to give you a blunt idea maybe this might help you.
So lets say a user has paid for your service you can flag a token in yours app's backend if a particular user is paid or not. So whenever the user logs in your app next time you can get the status of the logged user.
Once you get the status of the logged user you can enable or disable ui elements.
I hope this made some sense.
Here's the scenario. I am developing a one page app:
Most of the operations are achieved through ajax.
The page should show different components in different user login state (admin, normal user, visiter...)
There's so many animations in the page.
Does it mean that it would be necessary to check whether the user has logged in or not each time he clicks a button (some buttons can expand to a menu, whose components are partly shown according to the login state)?
Are there any better possible solutions?
Yes, you should. Only the server knows who should and should not do certain actions. It's mandatory to do checks on the server-side. Never trust the client.
Yes, to be secure you need to make the server authoritatively decide what the client can and CANNOT do. Because javascript is run client side, anyone can modify it and make it run how they want. The server is what you control, and you must use this to ensure that any requests by the client are valid and then follow through on or reject them accordingly.
Servers should almost always be authoritative in this way.
It is probably a good idea to use a UI object (with for example menu options) based on user privileges. Your server side code can return some JSON which includes only menu options that the current user can see and you use that object to construct the front end for that user. So if a user clicks a button to expand a menu you don't have to check anything just display what was returned from the server initially.
You should check permissions every time someone performs a "meaningful" operation in the system such as rename an object or request some data or delete something. This check can be easily built in into your backend API...
I want to develop a small javascript tool for browsers.
This tool can extract some content from current webpage and submit it to another site.
The whole work flow is divided into 3 stages.
The first stage is to extract content from current page.
The second stage is to log in. The user needs to enter their username and password in a login form.
The third stage is to submit the content abstracted from the first stage.
My problem is that the third stage needs the cookie from the second stage.
I have tried iframe, but failed.
Cookies need to be, at least, on the same top domain and the cookie set to be visible up to the top domain. If you are on another domain, this is not a viable option.
Another way you can pass data is via a form submit. Assuming you are on a page on a foreign domain, using this technique, you can have your script build a login form that submits to your site, along with the data you gathered. It also means the 2nd and 3rd step is merged. No cookies needed.
I want to create a popup which is easy, but here's thing, I want to hide it if you become a paid member, and I want it to appear again if you don't subscribe the next month, I am using the paypal button html code and not the ipn, the paypal button is in the account section of the site, well if you want I can put it in the pop-up and i can use the ipn if i have to, instead of the html code just want someone to guide me on how it's done
You're going to need some sort of user authentication to see if someone has purchased your product or not. This should be handled with a server-side language (PHP, Ruby, etc.) and you can change the layout of your page based on whether the user has authenticated or not.
If you don't have any server-side code, you could use cookies that are saved when you receive a successful callback from PayPal, but that isn't going to be very reliable because they won't be found if the user changes browsers or computers.
If you dont want to use a back-end then use cookies. If they have correct values stored in the cookie, use javascript to hide or change the elemts on the page