Invite Only app for Django Auth - django

I'm working on a Django web app and want to restrict signup to my site. For thatI want to use invite only app..I could find a couple of app built on the top of Django registration but I'm using Django Auth . Is there any app which I can use with Django app to get the same functionality.

General idea:
First, you can check out the code I have written which works fine for me.
Take a look at the example include in the application, you will learn
how to write your own pipeline. this pipeline can be redirected to any
view you would like.
from there you can save a invitation_key in your sessions and if that
key is valid, you can continue with create_user built in pipeline.
I have used this application for invitations that produces and validates invitation keys.
Implementation
It took me quite a day to figure it out.

This is a invite app built on allauth which restricts signup to invite only:
https://pypi.python.org/pypi/django-invitations/0.12

Related

Django Authentication Hardcoding Users

I have a django project with two apps (app and authenticate) that I got from a template. I developped my "app" app and it works fine. Now I want to add logins to limit access to certain pages of the app.
I looked accross the Internet and they use
user = User.objects.create_user('myusername', 'myemail#crazymail.com', 'mypassword')
to create a user. I tried that (and tried logging in with the username and password but it doesn't work. I probably put the code in a wrong area (I put it in authentication/models.py). I would really like this to work but I can't seem to figure out why the user isn't created.
there is no method create_user(). You must write User.objects.create('myusername', 'myemail#crazymail.com', 'mypassword')

Ember application with an admin site

I'm creating a basic Ember application. I am trying to set up a backend that stores posts. I would like to have a system where I can go to some admin site that has a form that has all the fields for a post that allows me to add, update, and delete posts. For example, if I have a Post model with attributes like Title, Contents, Date_created, and Image, I would like to have these fields in a form in some kind of admin site.
One example from a past tutorial I have done is the Django admin site. Is it possible to set up a Django backend for my Ember app? The Django admin is here: (scroll to bottom)
https://docs.djangoproject.com/en/1.10/intro/tutorial02/
I know that asking how to set up a backend for my Ember application is a very general question, but I am confused as to where to start. I have already created a Post model with various attributes. I can create an Ember route that is a form to add a post, but then there comes authentication for that which I'm not really sure how to deal with either. That's why I came to Django because I remember they had a very nice admin site.
If it is not feasible to use Django to accomplish this, what are some other routes I can take to be able to get to some admin page where I can manipulate records and add new data to my website?
This is a pretty big question, but I feel your pain. Most tutorials are all, "so... just build out a rails app... or use all this long lost stubbing stuff... or here's a super outdated node server on github to use."
I would suggest breaking it down into pieces. Ember is really great, but–Yes–you need a backend. You could make a backend with Django(python), Rails(ruby), WordPress(PHP) + ember-wordpress, express or hapi(node), phoenix(elixir)- or really anything that will generate an API. You could also build an admin with Ember and then use that to send data to a service like parse or firebase. Those could get you an MVP while you learn more about how to build out a traditional back-end.
Django + http://www.django-rest-framework.org has a pretty great admin setup that builds out the admin and fields from your API specifications. I can see why people like it.
I would also mention, that ember-cli-mirage is great when you aren't sure what backend you'll have, but you need to have a mock-server to build off of.
If you can, choose something that will spit out an API with jsonAPI.
I would split this into 2 parts.
build out an Ember app with Mirage or some other temporary data.
build a back-end somehow.
Then you can connect them ~ without being stuck beforehand.
Good luck!
So pretty much a blog site where only person can create/delete/edit posts? If so then all you have to do is create a user with a predefined username and password in your Django app. You login through your Ember app. For this protected view you will need to use ember-simple-auth, which is the simplest way to implement something like this. Google ember-simple-auth and run its dummy app to see what they are doing.

django : how to confirm registration without email verification

I wnat to confirm registration without email verification
How can it config?
And, Where is the django-registration views?
Can I change the registration views?
Thank you.
You could use django-social-auth to make users register with their social account (which has been verified already). This would have the added bonus of being much quicker to sign up via.
You can see the registration views here. If you want to change them, copy the urls from django-registration's urls.py and put them into your own urls.py, then link them to a new views.py file and wrap the registration views with your own custom code.
Django-registration comes with a default backend as well as a simple backend.
The default backend takes care of the email verification / activation.
If you want to disable the email verification in django-registration, then you'd need to use the simple backend instead.
Add something like the following to your urls.py:
(r'^registration/', include('registration.backends.simple.urls')),
i would use janrain or gigya, i think janrain is better, it's just my opinion.
anyway what that would do is let people login using facebook, gmail, twitter etc.. like the django social auth...i'm just giving you other options :)

User management app for Django's auth

I am working on a small Django site where every user who leaves a comment on the site gets an email with a password (email is the user name) to change the comment later on.
The site should also support functions for users to retrieve or reset passwords. For this simple task I wanted to use the Django auth capabilities.
Is there a Django app which provides a simple package of user management (to reset or change a user's password) which I could incorporate in my site?
Would packages like Pinax or Drupal help for this simple task? They seem to be the overkill.
If you are looking for an advanced profile-/account-module you could take a look at django-userena
Some other options are listed in the profiles-grid on Django Packages.
Reset and change password are both included in the standard contrib.auth views.
I would have a look at django-user-accounts

How to authenticate against Django from Drupal?

I have a medium sized Drupal 6 site running (around 5 million page views per month and more than 30K registered users) and I need to integrate OSQA, a Django application, with it. I already have many users, roles and permissions in my Drupal database and I'd like to point the Django app to use the sign up and login pages I already have in Drupal to give my users a single point on entrance.
I want to keep the Django authentication part because I think OSQA would work better. I also have performance reasons in mind, the Drupal site already gets a lot of traffic and has a very busy database and I think that using a separate database for Django would help.
After some research I think I could make the Drupal sign up and login pages call Django in the background to sign up or login to the Django app. I plan to do this writing a couple of views in Django, one for sign up and another for login, and Drupal would post the username and password to those views. Of course I'd need to disable CSRF in Django for those views and probably also post some secret key that only my Drupal and Django applications know about to avoid external sites trying to use this "unprotected" Django views.
I know that my Django application may need some user data from Drupal at some points and I'm planning on using the Drupal services module for that.
Would this be a good approach? Any suggestions?
Thanks a lot!
Are there any plugins for OSQA to expose an authentication service that Drupal can talk to? (OpenID or similar).
Alternatively, check out Drupal's ldap_integration module for an example of a module that uses an external authentication service. Consider that you will need to create Drupal user accounts for each login.
Finally, why not just build the essential parts of OSQA's functionality with Drupal? Seems like the key functionality could be replicated quite easily using Taxonomy, Vote Up and Userpoints/User Badges... potentially easier to do than shared authentication, especially on a large site.
I once created a very simple [sql_authentication][1] module, which you can probably simply re-create for a more recent version of Drupal.
The idea is simple: provide Drupal with an alternative authentication callback.
In that callback-function, just check against the Django database, and return TRUE if you think the user is correct.
You could look at how openid.module (in core) extends the user-authentication for a simple example.
If you can post to the Django form, you may be able to use drupal_http_request to handle the call to Django. After using the ldap_integration module for a while, I worked on a custom authentication module that calls a Java-based REST authentication API using drupal_http_request. If you're interested in the code, let me know.