GithubHelp home page GithubHelp logo

idlesign / django-sitegate Goto Github PK

View Code? Open in Web Editor NEW
33.0 6.0 4.0 329 KB

Reusable application for Django to ease sign up & sign in processes

Home Page: https://github.com/idlesign/django-sitegate

License: BSD 3-Clause "New" or "Revised" License

Python 90.84% HTML 9.16%
python django authentication signin signup authorization

django-sitegate's Introduction

django-sitegate

http://github.com/idlesign/django-sitegate

image

image

image

What's that

django-sitegate is a reusable application for Django to ease sign up & sign in processes.

This application will handle most common user registration and log in flows for you.

Sign in

  • username/e-mail + password
  • username + password
  • Yandex
  • Google

Sign up

  • username/e-mail + password
  • invitation code + username/e-mail + password
  • username + password
  • username + e-mail + password
  • username + password + password confirmation
  • username + e-mail + password + password confirmation

Quick example

Here follows the most straightforward way possible with django-sitegate to have both sign up & sign in functionality on your page.

  1. Use sitegate_view decorator to mark your view as the one handling both signups and signins:

    from django.shortcuts import render
    
    from sitegate.toolbox import sitegate_view
    
    @sitegate_view  # This also prevents logged in users from accessing our sign in/sign up page.
    def entrance(request):
        return render(request, 'entrance.html', {'title': 'Sign in & Sign up'})
  2. Then in your template load sitegate tag library and put sitegate_signup_form & sitegate_signin_form tags in place where you want a registration and sign in forms to be.

    {% extends "_base.html" %}
    {% load sitegate %}
    
    {% block page_contents %}
        <div class="my_signin_block">
            {% sitegate_signin_form %}
        </div>
        <div class="my_signup_block">
            {% sitegate_signup_form %}
        </div>
    {% endblock %}

You're done. Now your site visitors have an e-mail + password form to register and username/e-mail + password form to log in.

And mind that we've barely made a scratch of sitegate. Read the docs.

Documentation

http://django-sitegate.readthedocs.org/

django-sitegate's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-sitegate's Issues

How to change "Default redirect URL"

Hi. Thanks for the work.
Kindly tell me how to change the Default redirect URL from /.
I have scoured the docs but can't find a setting key or API.

Thanks in Advance.

Creating new Signup/Signin Flows

Is there a recommended way to create a new signup/signin flows?

My use case is doing case-insensitive matches on the username followed by the email address, where the username can be different from the email address.

Example views fail in Django 1.5+

This approach is used throughout the documentation.

from django.shortcuts import render
from sitegate.decorators import sitegate_view

@sitegate_view  
def entrance(request):
    return render(request, 'entrance.html', {'title': 'Sign in & Sign up'})

But the request variables don't flow to the templatetag context. Fail!

This works:

@signup_view(flow=ModernSignup)
def register(request):
    return render(RequestContext(request), 'enter.html', {'title': 'Sign up'})

summary:

request -> RequestContext(request)

Django 1.8 says that there are changes that is not reflected in a migration when running migrate

Hi!

When running manage.py migrate on Django 1.8 and django-sitegate 0.10.2, it tells me

Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

When running makemigrations, the output is:

Migrations for 'sitegate':
  0002_auto_20150929_1728.py:
    - Alter field code on emailconfirmation
    - Alter field code on invitationcode

But in general sitegate seems to work. Could you please add these migrations to a repository?

Missing migration (minor issue)

Hi,
it seems that after latest changes in models.py (1 month ago) Django started complaining about a missing migration when running python ./manage.py migrate on a vanilla project (after installing django-sitegate using pip and after adding django-sitegate to the installed apps):

out:   Your models have changes that are not yet reflected in a migration, and so won't be applied.
out:   Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

it's a minor issue, I can run manage.py makemigrations on every virtualenv as suggested and "patch" the installed PyPi package, but maybe you would add the migration in django-sitegate itself.

thanks
Stefano

email address longer than 30 characters

With the email / password signup flow, the email address is inserted as the username. The max length for email address is 75 characters while the max for username is 30. What happens if an email address longer than 30 characters is used?

I tried this on my local machine with SQLite and it silently inserted the a > 30 character username but on other backends I think this will raise an exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.