I am trying to handle my authentication and user system, with django restframework, using mongodb as my database. I've searched the whole internet for a good sample of code for my purpose to work.
But you may know that any article which is published in this issue doesn't work and you have so many errors while running the code.
does anyone know a good piece of code or an article that may help?
Related
I am building a user module from scratch where users can do pretty much all regular user operations from login,signup,..., to account deactivation. The thing is that I am not using mongoengine or django ready-made models that simplify sql connections, instead I am doing everything from scratch using pymongo driver to connect to mongodb database where I need to code all CRUD operations. I am stuck at creating a temporary link for users to (1) confirm account - this link should not be expired, (2) reset password, this link expires in few days. I have two questions regarding this:
1- can i still use django token generator/ authentication library? I am not using Users django library so my users are just ones I create and insert to database, if yes how can i do that?!
2- if no, how can I generate those temp links considering similar level of security that django library adopts, i.e. hashed username/ salted.. etc.
any advice if I am doing something wrong or I should re-do everything considering mongoengine as my driver so that I can inherit and use django models?! any recommendation is highly appreciated.
Thank you
I would recommend to extend the existing User Model.
Seems easier, faster and more secure than doing everything on your own.
Here is a good source for your options.
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html
I have built my first Django App! It is built to help my business track inventory. As such, I would not like it to be publicly available.
Maybe someday I will set up multiple user accounts, etc, but for now I really just need a basic password gate to get it up and running.
Does anyone have any middleware that works for this? All the solutions that I am finding are pretty old and they do not seem to work with the latest version of Django.
If you just need a single username/password couple, handling it directly via HTTP authentication in your webserver configuration will be the easiest way to achieve this. The benefits of this approach are:
You can set it up in 5 minutes: example with nginx, example with apache
You don't have to write code you'll delete later
It will protect all your website, including static files, third-party apps, admin, etc.
I found an answer that worked for me posted here:
#login_required for multiple views
Make sure the LOGIN_REQUIRED_URLS_EXCEPTIONS path is correctly set to your login page.
I have been reading and doing Django Tutorials for a while now. I am looking to build a relatively simple Survey facility for an experiment I am running.
However almost all of the form tutorials I have looked at relate to submitting a form to an email address e.g.
DjangoBook Chapter 7
Working with Forms
There are some old SO questions on this topic as well but the resources are either not complete or out of date.
I am looking to store the users feedback in the SQLite database. Can anyone recommend any resources for this? I understand that the methodology is similar but there seems to be much less information about it.
Thanks
The Django tutorial does exactly what you requested. In the part 4 it's explained how to create a form and save the voting resuts to the database.
I'm hoping there's a straightforward answer to this question.
First, some history: I deployed a Django project and it uses all of the authentication mechanisms provided in Django. Namely, users are stored in auth_users and my login app validates against the records found in that table.
Now, I have a second, distinct Django project that needs to authenticate against the database from the original application. I'm not entirely sure how can I approach the problem, so I'm hoping someone in the stackoverflow community can help.
One thought was to add "myfirstproject.login" to the INSTALLED_APPS of the second project, but I'm uncertain if that's a viable option (CSRF issues?). Again, any insight is appreciated.
Try the sites module?
http://docs.djangoproject.com/en/1.3/ref/contrib/sites/
Create an auth backend?
http://docs.djangoproject.com/en/1.3/topics/auth/#specifying-authentication-backends
Inherit from contrib.auth to create your own auth module?
CSRF would only be an issue if you were trying to authenticate by telling the client browser to ask the first site for auth; which is unlikely to be the best path to take.
I am currently working an a webapp, using mongoengine and django, which will require users to create an account from a registration page. I know MongoEngine has an authentication backend, but does it also include a registration form, etc..., like django itself does? If not, are there any example projects which show how to implement this? The only open-source mongoengine project I've found is django-mumblr, but I can't find the examples I want in it.
I'm not interested in alternative options, such as MongoKit or mango for handling authentication.
I am just getting started with django and mongoDB, so please excuse my lack of knowledge. Thanks in advance for the help!
Not tried it out yet, but https://github.com/lig/django-registration-me by http://twitter.com/#!/lig1 looks like it could be a good bet.