Fixed blling form goes out of background image, Fixed billing address page "amount" field seems broken, Changed authentication page fonts

Added new DG login.html, Fixed DG login contact footer, Added new DG login form, Added  DG login, Added DG signup, Added DG reset password, Added DG confirm reset password, Added DG membership payment view
 Please enter the commit message for your changes. Lines starting
This commit is contained in:
Levi 2016-08-20 00:57:35 -05:00
parent 1470caee89
commit f56f294205
23 changed files with 1512 additions and 140 deletions

36
digitalglarus/forms.py Normal file
View file

@ -0,0 +1,36 @@
from django import forms
from django.utils.translation import ugettext_lazy as _
from utils.models import BillingAddress
from utils.forms import LoginFormMixin, SignupFormMixin, BillingAddressForm
from .models import MembershipType
class LoginForm(LoginFormMixin):
email = forms.CharField(widget=forms.EmailInput())
password = forms.CharField(widget=forms.PasswordInput())
class SignupForm(SignupFormMixin):
confirm_password = forms.CharField(widget=forms.PasswordInput())
password = forms.CharField(widget=forms.PasswordInput())
name = forms.CharField(label='name',
widget=forms.TextInput(attrs={'placeholder': 'Full name'}))
class MembershipBillingForm(BillingAddressForm):
token = forms.CharField(widget=forms.HiddenInput())
membership_type = forms.ModelChoiceField(queryset=MembershipType.objects.all(),
widget=forms.HiddenInput())
class Meta:
model = BillingAddress
fields = ['membership_type', 'street_address', 'city', 'postal_code', 'country']
labels = {
'street_address': _('Street Address'),
'city': _('City'),
'postal_code': _('Postal Code'),
'country': _('Country'),
}

View file

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-08-20 04:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('digitalglarus', '0006_delete_message'),
]
operations = [
migrations.CreateModel(
name='Membership',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
migrations.CreateModel(
name='MembershipOrder',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('approved', models.BooleanField(default=False)),
('last4', models.CharField(max_length=4)),
('cc_brand', models.CharField(max_length=10)),
('stripe_charge_id', models.CharField(max_length=100, null=True)),
('membership', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='digitalglarus.Membership')),
],
),
migrations.CreateModel(
name='MembershipType',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(choices=[('standard', 'Standard')], max_length=20)),
('price', models.FloatField()),
],
),
migrations.AddField(
model_name='membership',
name='type',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='digitalglarus.MembershipType'),
),
]

View file

@ -4,6 +4,35 @@ from filer.fields.image import FilerImageField
from django.core.urlresolvers import reverse
class MembershipType(models.Model):
MEMBERSHIP_TYPES = (
('standard', 'Standard'),
)
name = models.CharField(choices=MEMBERSHIP_TYPES, max_length=20)
price = models.FloatField()
class Membership(models.Model):
type = models.ForeignKey(MembershipType)
@classmethod
def create(cls, data, user):
instance = cls.objects.create(**data)
instance.assign_permissions(user)
return instance
class MembershipOrder(models.Model):
membership = models.ForeignKey(Membership)
created_at = models.DateTimeField(auto_now_add=True)
approved = models.BooleanField(default=False)
last4 = models.CharField(max_length=4)
cc_brand = models.CharField(max_length=10)
stripe_charge_id = models.CharField(max_length=100, null=True)
class Supporter(models.Model):
name = models.CharField(max_length=200)
description = models.TextField(null=True, blank=True)
@ -16,6 +45,8 @@ class Supporter(models.Model):
class DGGallery(models.Model):
parent = models.ForeignKey('self', blank=True, null=True)
name = models.CharField(max_length=30)

View file

@ -0,0 +1,622 @@
@charset "UTF-8";
/* CSS Document */
#membership-includes {
text-align: center;
color: #fff;
background-attachment: scroll;
background-image: url(../img/header_bg_5.png);
background-position: center center;
background-repeat: none;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.intro-headline-small{
font-family: 'Raleway' , "Open Sans Bold", Helvetica, Arial, "Arial Bold", sans-serif;
font-size: 46px;
font-style: normal;
font-weight: 200;
text-transform: none;
text-transform: uppercase;
color: #FFF;
}
.intro-smaller {
font-family: 'Raleway' ,'Montserrat' ,"Open Sans Bold", Helvetica, Arial, "Arial Bold", sans-serif;
font-size: 16px;
font-style: normal;
font-weight: 100;
text-transform: none;
color: #FFF;
}
.intro-price {
padding-top: 70px;
padding-bottom: 50px;
}
.ul{
columns: 2;
padding: 15px 0;
font-size: 18px;
font-weight: 300;
color: #fff;
margin: 40px 0;
}
.price-list{
background-color: transparent;
font-size: 18px;
border: 0;
padding-top: 15px;
padding-bottom: 15px;
}
.price{
text-transform: none;
}
#price {
background-image: url(../img/bg-price.png);
background-position: center center;
background-repeat: none;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.price-box{
padding-left: 15px;
padding-right: 15px;
padding-top: 15px;
padding-bottom: 30px;
margin-top: 80px;
margin-bottom: 30px;
margin-left: 10px;
margin-right: 10px;
color: inherit;
background-color: #fff;
}
.graph{
padding-top: 30px;
}
.glyphicon-ok{
margin-right: 0.5em;
}
.glyphicon-plus{
font-size: 42px;
display: block;
text-align: center;
margin: 40px auto 20px;
color: #88c7d7;
}
.signup-container {
padding: 0;
margin: 0;
overflow-x: hidden;
}
.greyline{
border-color: #ddd;
border-width: 1px;
max-width: 600px;
}
.greyline-long{
border-color: #ddd;
border-width: 1px;
max-width: 95%;
}
.signup-form {
padding: 2em;
padding-top: 1em;
padding-bottom: 0.1em;
margin-bottom: 0px;
}
.signup-lead {
font-size: 16px;
line-height: 1.4em;
text-transform: none;
}
.form-control {
margin-bottom: 1em;
border-image-source: initial;
border-image-slice: initial;
border-image-width: initial;
border-image-outset: initial;
border-image-repeat: initial;
min-height: 20px;
background: rgb(255, 255, 255);
border-width: 1px;
border-style: solid;
border-color: rgba(37, 39, 41, 0.498039);
padding: 10.5px 10px;
transition: all 0.15s ease-in-out;
}
.notice-box {
padding-top: 1.5em;
padding-bottom: 2em;
}
.signup-text {
color: #777;
margin: 0;
line-height: 1.5;
font-size: 13px;
text-transform: none;
font-family: "Helvetica Neue" ,"Helvetica Neue" ,"Open Sans" ,"Arial" , sans-serif;
color: #999;
}
.signup-text a {
font-weight : 400;
margin-left: 0.5em;
color: #31708f;
}
.signup-notice a {
font-weight : 400;
margin-left: 0.5em;
color: #31708f;
}
.signup-box {
padding-left: 15px;
padding-right: 15px;
padding-top: 15px;
padding-bottom: 15px;
margin-top: 80px;
margin-bottom: 30px;
margin-left: 10px;
margin-right: 10px;
color: inherit;
background-color: #fff;
}
.signup-notice {
padding-top: 0.5em;
font-size: 12px;
color: #777;
}
.glyphicon-user{
font-size: 42px;
display: block;
text-align: center;
margin: 40px auto 20px;
color: #88c7d7;
}
.glyphicon-ok {
font-size: 42px;
display: block;
text-align: center;
margin-bottom: 20px;
color: #88c7d7;
margin-top: 0px;
}
}
.membership-amount{
font-size: 18px;
text-align: right;
width: 100%;
}
.payment-box{
padding-top: 3em;
padding-left: 30px;
padding-right: 30px;
padding-bottom: 15px;
margin-top: 80px;
margin-bottom: 30px;
margin-left: 10px;
margin-right: 10px;
color: inherit;
background-color: #fff;
}
.payment-head{
font-weight: 600;
padding-left: 15px;
text-align: left;
}
.membership-lead {
font-size: 16px;
line-height: 1.4em;
text-transform: none;
text-align: left;
padding-left: 15px;
padding-right: 15px;
font-family: helvetica neue, helvitica, open-sans, sans-serif;
font-weight: 200;
}
.order-name{
font-size: 18px;
text-transform: uppercase;
margin: 0;
font-weight: 700;
padding-top: 15px;
padding-bottom: 15px;
letter-spacing: 1px;
}
.order-person{
text-align: right;
margin-top: 0;
margin-bottom: 15px;
font-size: 20px;
color: #494949;
text-transform: none;
}
.order-item{
font-size: 18px;
text-transform: none;
font-weight: 400;
text-align: left;
width: 100%;
letter-spacing: 0.1px;
}
.order-duration {
padding-bottom: 1em;
color: #999;
font-size: 16px;
text-transform: none;
font-weight: 200;
text-align: left;
width: 100%;
margin-top: 5px;
}
.header{
padding: 12px 15px;
margin-bottom: 0;
border-bottom: 2px solid #f7f7f7;
background-color: #a1cfd7;
}
.payment-total{
font-size: 16px;
text-transform: none;
margin: 0;
font-weight: 200;
letter-spacing: 1px;
}
.order-sum {
text-align: right;
margin-top: 0;
margin-bottom: 15px;
font-size: 20px;
color: #494949;
}
.order-result {
font-family: open-sans, montserrat, Helvetica Neue, Helvetica, sans-serif;
margin-top: 0;
margin-bottom: 15px;
font-size: 28px;
color: #494949;
text-align: right;
}
.order-bottom-text {
padding-top: 0.5em;
color: #777;
padding-left: 15px;
font-size: 13px;
}
.order-bottom-text a {
font-weight : 400;
margin-left: 0.5em;
color: #31708f;
}
.order-summary {
background-color:#fff;
margin-top: 80px;
}
.order-box{
padding-top: 0;
padding-left: 20px;
padding-right: 20px;
padding-bottom: 15px;
margin-top: 0;
margin-bottom: 30px;
margin-left: 10px;
margin-right: 10px;
color: inherit;
background-color: #fff;
}
.billing-head {
padding-left: 15px;
margin-top: 0px;
margin-bottom: 0px;
font-weight: 400;
font-size: 21px;
text-align: left;
text-transform: none;
}
.reset-head {
padding-left: 15px;
margin-top: 0px;
margin-bottom: 0px;
font-weight: 400;
font-size: 24px;
text-align: left;
text-transform: none;
}
.form-control {
color: #999;
border-radius: 0px;
box-shadow: none;
}
.custom-control-description {
color: #999;
font-weight: 300;
font-family: "helvetica neue", "helvetica", "sans-serif" ;
letter-spacing: 0.5px;
font-size: 12px;
line-height: 1;
}
.custom-control-description a {
color: #31708f;
}
.custom-control {
text-align: left;
}
.button-box {
margin-top: 20px;
}
.date-box {
padding-top: 1.5em;
padding-bottom: 0.5em;
}
.date-oneline {
font-size: 16px;
text-transform: none;
margin: 0;
font-weight: 400;
letter-spacing: 1px;
color: #555;
}
.btn-grey {
background-color: #b2b7b9;;
border-color: #b2b7b9;;
}
.btn-grey:hover,
.btn-grey:focus,
.btn-grey:active,
.btn-grey.active,
.open .dropdown-toggle.btn-grey {
text-transform: uppercase;
font-weight: 400;
border-color: #ddd;
color: #fff;
background-color: #ddd;
}
.btn-blue:hover,
.btn-blue:focus,
.btn-blue:active,
.btn-blue.active,
.open .dropdown-toggle.btn-grey {
background-color: #5699b9;
border-color: #5699b9;
}
.loggedin-head {
padding-left: 15px;
margin-top: 0px;
margin-bottom: 0px;
font-weight: 400;
font-size: 21px;
text-align: center;
text-transform: none;
padding-top: 10px;
}
.loggedin-lead {
font-size: 16px;
line-height: 1.4em;
text-transform: none;
text-align: center;
padding-left: 15px;
padding-right: 15px;
font-family: helvetica neue, helvitica, open-sans, sans-serif;
font-weight: 200;
}
.activation-lead {
font-size: 15px;
line-height: 1.4em;
text-transform: none;
text-align: center;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 0;
font-family: helvetica neue, helvitica, open-sans, sans-serif;
font-weight: 200;
color: #777;
}
.button-booking-box {
margin-top: 0;
}
.member-name{
font-size: 16px;
text-transform: none;
font-weight: 400;
text-align: left;
width: 100%;
letter-spacing: 0.1px;
text-align: left;
padding-left: 15px;
line-height: 0.35em;
}
.history-name{
font-size: 16px;
text-transform: none;
font-weight: 400;
text-align: left;
width: 100%;
letter-spacing: 0.1px;
text-align: left;
padding-left: 15px;
line-height: 1.4em;
}
.button-center-box {
margin-top: 20px;
text-align: center;
}
.table td, .table th {
padding: .75rem;
vertical-align: top;
border-top: 1px solid #eceeef;
}
.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
padding: .75rem;
vertical-align: top;
border-top: 1px solid #eceeef;
border-bottom: 1px solid #eceeef;
color: #777;
}
.table{
margin-top: 1em;
}
.order-head {
font-size: 18px;
text-transform: uppercase;
margin: 0;
font-weight: 900;
padding-top: 15px;
letter-spacing: 1px;
text-align: left;
padding-left: 15px;
color: #88c7d7;
}
th {
text-align: center;
}
.table td {
color: #999;
}
.btn-edit {
font-size: 10px;
padding-left: 8px;
padding-right: 8px;
padding-top: 2px;
padding-bottom: 2px;
background-color: #b2b7b9;
border-color: #b2b7b9;
color: #fff;
font-weight: 200;
margin-left: 1em;
}
.edit-button {
text-align:left;
padding-left: 15px;
padding-top: 10px;
}
.btn-deactivate {
font-size: 11px;
padding-left: 10px;
padding-right: 10px;
padding-top: 4px;
padding-bottom: 4px;
color: #fff;
font-weight: 200;
}
.btn-darkgrey {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: 400;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
background-color: #777;
border-color: #777;
text-transform: none;
}
.btn-darkgrey:hover,
.btn-darkgrey:focus,
.btn-darkgrey:active,
.btn-darkgrey.active,
.open .dropdown-toggle.btn-darkgrey {
text-transform: none;
font-weight: 400;
border-color: #88c7d7;
color: #fff;
background-color: #88c7d7;
}
.thankyou {
font-size: 30px;
text-align: center;
padding-top: 45px;
}
.icon-up{
margin-top: 30px;
}
.price-exp-box {
padding-left: 15px;
padding-right: 15px;
padding-top: 15px;
padding-bottom: 0px;
margin-top: 0px;
margin-bottom: 30px;
margin-left: 10px;
margin-right: 10px;
color: inherit;
background-color: #fff;
text-align: left;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -0,0 +1,124 @@
$( document ).ready(function() {
$.ajaxSetup({
beforeSend: function(xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
}
});
var $form = $('#payment-form');
$form.submit(payWithStripe);
/* If you're using Stripe for payments */
function payWithStripe(e) {
e.preventDefault();
/* Visual feedback */
$form.find('[type=submit]').html('Validating <i class="fa fa-spinner fa-pulse"></i>');
var PublishableKey = window.stripeKey;
Stripe.setPublishableKey(PublishableKey);
Stripe.card.createToken($form, function stripeResponseHandler(status, response) {
if (response.error) {
/* Visual feedback */
$form.find('[type=submit]').html('Try again');
/* Show Stripe errors on the form */
$form.find('.payment-errors').text(response.error.message);
$form.find('.payment-errors').closest('.row').show();
} else {
/* Visual feedback */
$form.find('[type=submit]').html('Processing <i class="fa fa-spinner fa-pulse"></i>');
/* Hide Stripe errors on the form */
$form.find('.payment-errors').closest('.row').hide();
$form.find('.payment-errors').text("");
// response contains id and card, which contains additional card details
var token = response.id;
// AJAX
//set token on a hidden input
$('#id_token').val(token);
$('#billing-form').submit();
}
});
}
/* Form validation */
$.validator.addMethod("month", function(value, element) {
return this.optional(element) || /^(01|02|03|04|05|06|07|08|09|10|11|12)$/.test(value);
}, "Please specify a valid 2-digit month.");
$.validator.addMethod("year", function(value, element) {
return this.optional(element) || /^[0-9]{2}$/.test(value);
}, "Please specify a valid 2-digit year.");
validator = $form.validate({
rules: {
cardNumber: {
required: true,
creditcard: true,
digits: true
},
expMonth: {
required: true,
month: true
},
expYear: {
required: true,
year: true
},
cvCode: {
required: true,
digits: true
}
},
highlight: function(element) {
$(element).closest('.form-control').removeClass('success').addClass('error');
},
unhighlight: function(element) {
$(element).closest('.form-control').removeClass('error').addClass('success');
},
errorPlacement: function(error, element) {
$(element).closest('.form-group').append(error);
}
});
paymentFormReady = function() {
if ($form.find('[name=cardNumber]').hasClass("success") &&
$form.find('[name=expMonth]').hasClass("success") &&
$form.find('[name=expYear]').hasClass("success") &&
$form.find('[name=cvCode]').val().length > 1) {
return true;
} else {
return false;
}
}
$form.find('[type=submit]').prop('disabled', true);
var readyInterval = setInterval(function() {
if (paymentFormReady()) {
$form.find('[type=submit]').prop('disabled', false);
clearInterval(readyInterval);
}
}, 250);
});

View file

@ -0,0 +1,55 @@
{% extends "new_base_glarus.html" %}
{% load staticfiles cms_tags bootstrap3%}
{% block title %}crowdfunding{% endblock %}
{% block content %}
<section id="price">
<div class="signup-container">
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div>
<div class="col-xs-12 col-sm-6 col-lg-4 text-center wow fadeInDown">
<div class="payment-box">
<h2 class="billing-head">Set your new password</h2>
<hr class="greyline-long">
<div class="signup-form form-group row">
<form action="" method="post" class="form" novalidate>
{% csrf_token %}
{% for field in form %}
{% bootstrap_field field show_label=False type='fields'%}
{% endfor %}
<p>{{form.non_field_errors|striptags}}</p>
<button type="submit" class="btn btn-primary btn-blue">Reset</button>
</form>
<br>
<div class="notice-box">
<p class="order-bottom-text">Still have trouble? Contact us for technical support.</p>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"></div>
</div>
</div>
</section>
<section id="contact">
<div class="fill">
<div class="row" class="wow fadeInDown">
<div class="col-lg-12 text-center wow fadeInDown">
<div class="col-md-4 map-title">
Digital Glarus<br>
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
<br>info@digitalglarus.ch
<br>
(044) 534-66-22
<p>&nbsp;</p>
</span>
</div>
<p>&nbsp;</p>
</div>
</div>
</div>
</section>
{% endblock %}

View file

@ -0,0 +1,13 @@
{% load i18n %}{% autoescape off %}
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ base_url }}{% url 'digitalglarus:reset_password_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}

View file

@ -0,0 +1,13 @@
{% load i18n %}{% autoescape off %}
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ base_url }}{% url 'digitalglarus:reset_password_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}

View file

@ -0,0 +1,78 @@
{% extends "new_base_glarus.html" %}
{% load staticfiles bootstrap3 i18n %}
{% block content %}
<section id="price">
<div class="signup-container">
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div>
<div class="col-xs-12 col-sm-6 col-lg-4 text-center wow fadeInDown">
<div class="signup-box">
<span class="glyphicon glyphicon-user"></span>
<h2 class="section-heading">Log In</h2>
<h2 class="signup-lead">Welcome!<br></h2>
{% if messages %}
<ul class="list-unstyled">
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<hr class="primary">
{% block messages %}
{% if request.GET.logged_out %}
<div class="alert"> <!-- singular -->
<a class="close" data-dismiss="alert">×</a>
{% trans "You haven been logged out"%}
</div>
{% endif %}
{% endblock %}
<div class="signup-form form-group row">
<form action="{% url 'digitalglarus:login' %}" method="post" class="form" novalidate>
{% csrf_token %}
<input type="hidden" name="" value="{{ request.GET.next }}">
{% for field in form %}
{% bootstrap_field field show_label=False type='fields'%}
{% endfor %}
<p>{{form.non_field_errors|striptags}}</p>
<p class="signup-notice">By logging in you agree to our<a href=#terms>Terms of Service</a>.</p>
<button type="submit" class="btn btn-primary btn-blue">Login</button>
</form>
<br>
<div class="notice-box">
<p class="signup-text">Forgot password?<a href="{% url 'digitalglarus:reset_password' %}">Find ID/Password</a></p>
<p class="signup-text">Not a member yet?<a href="{% url 'digitalglarus:signup' %}">Sign up </a>now.</p>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown">
</div>
</div>
</div>
</section>
<section id="contact">
<div class="fill">
<div class="row" class="wow fadeInDown">
<div class="col-lg-12 text-center wow fadeInDown">
<div class="col-md-4 map-title">
Digital Glarus<br>
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
<br>info@digitalglarus.ch
<br>
(044) 534-66-22
<p>&nbsp;</p>
</span>
</div>
<p>&nbsp;</p>
</div>
</div>
</div>
</section>
{% endblock %}

View file

@ -0,0 +1,177 @@
{% extends "new_base_glarus.html" %}
{% load staticfiles bootstrap3 i18n %}
{% block content %}
<style type="text/css">
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
</style>
<section id="price">
<div class="signup-container">
<div class="col-xs-12 col-sm-6 col-lg-8 text-center wow fadeInDown">
<div class="payment-box">
<h2 class="section-heading payment-head">Membership</h2>
<!-- <h2 class="membership-amount">35CHF</h2> -->
<h2 class="membership-lead">Your Digital Glarus Membership enables
you to use our coworking space and it includes
2 working days for the month you signed up.
The membership fee is a monthly subscription.
Additional day costs
15CHF per day. More than 17 days a month it
will charge only 290CHF/month.</h2>
<hr class="greyline-long">
<h2 class="billing-head">Member Name</h2>
<h2 class="member-name">Nico Schottelius</h2>
<hr class="greyline-long">
<h2 class="billing-head">Billing Adress</h2>
<div class="signup-form form-group row">
<form role="form" id="billing-form" method="post" action="{% url 'digitalglarus:membership_payment' %}" novalidate>
{% for field in form %}
{% csrf_token %}
{% bootstrap_field field show_label=False type='fields'%}
{% endfor %}
{% bootstrap_form_errors form type='non_fields'%}
<br>
</form>
</div>
<h2 class="billing-head">Credit Card</h2>
<div class="signup-form form-group row">
<form role="form" id="payment-form" novalidate>
<div class="row">
<div class="col-xs-9 col-md-12">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" name="cardName" placeholder="Name on card" required autofocus data-stripe="name" />
<span class="input-group-addon"><i class="fa fa-user" aria-hidden="true"></i></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-9 col-md-12">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" name="cardNumber" placeholder="Valid Card Number" required data-stripe="number" />
<span class="input-group-addon"><i class="fa fa-credit-card"></i></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6 col-md-6 nopadding">
<label for="expMonth">EXPIRATION DATE</label><br/>
<div class="col-xs-6 col-lg-6 col-md-6">
<div class="form-group">
<input type="text" class="form-control" name="expMonth" placeholder="MM" required data-stripe="exp_month" />
</div>
</div>
<div class="col-xs-6 col-lg-6 col-md-6 pl-ziro">
<div class="form-group">
<input type="text" class="form-control" name="expYear" placeholder="YY" required data-stripe="exp_year" />
</div>
</div>
</div>
<div class="col-xs-4 col-md-6 pull-right nopadding">
<div class="form-group">
<label for="cvCode">CV CODE</label>
<input type="password" class="form-control" name="cvCode" placeholder="CV" required data-stripe="cvc" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<button class="btn btn-success btn-lg btn-block" type="submit">Purchase membership</button>
</div>
</div>
<div class="row" style="display:none;">
<div class="col-xs-12">
<p class="payment-errors"></p>
</div>
</div>
{% if paymentError %}
<div class="row">
<div class="col-xs-12">
<p>
{% bootstrap_alert paymentError alert_type='danger' %}
</p>
</div>
</div>
{% endif %}
</form>
<br>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-lg-4 wow fadeInDown">
<div class="order-summary">
<div class="header text-center">
<h2 class="order-name">Order Summary</h2>
</div>
<div class="order-box">
<h2 class="col-xs-6 order-item">Digital Glarus Membership</h2>
<br>
<h2 class="col-xs-6 order-duration">valid 2016.09.08 - 2016.10.08</h2>
<h2 class="order-person">1 person</h2>
<h2 class="col-xs-6 payment-total">Today's Total</h2>
<h2 class="order-sum">0.00CHF</h2>
<hr class="greyline">
<h2 class="col-xs-6 payment-total">Total</h2>
<h2 class="order-result">35CHF</h2>
<div class="text-center">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">I accept the Digital Glarus <a href=#>Terms and Conditions</a>, <a href=#>Community Guidelines</a> and <a href=#>Privacy Policy</a></span>
</label>
<div class="button-box">
<button type="submit" class="btn btn-primary">Continue to Review</button>
</div>
<div class="button-box">
<p class="order-bottom-text">You can checkout on the next page</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="contact">
<div class="fill">
<div class="row" class="wow fadeInDown">
<div class="col-lg-12 text-center wow fadeInDown">
<div class="col-md-4 map-title">
Digital Glarus<br>
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
<br>info@digitalglarus.ch
<br>
(044) 534-66-22
<p>&nbsp;</p>
</span>
</div>
<p>&nbsp;</p>
</div>
</div>
</div>
</section>
<!-- stripe key data -->
{% if stripe_key %}
<script type="text/javascript">
(function () {window.stripeKey = "{{stripe_key}}";})();
</script>
{%endif%}
{% endblock %}

View file

@ -0,0 +1,57 @@
{% extends "new_base_glarus.html" %}
{% load staticfiles cms_tags bootstrap3%}
{% block title %}crowdfunding{% endblock %}
{% block content %}
<section id="price">
<div class="signup-container">
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div>
<div class="col-xs-12 col-sm-6 col-lg-4 text-center wow fadeInDown">
<div class="payment-box">
<h2 class="billing-head">Reset Password</h2>
<hr class="greyline-long">
<h2 class="membership-lead">To have your password reset, enter your email address below.
We will then send an email containing a link to reset your password.</h2>
<div class="signup-form form-group row">
<form action="{% url 'digitalglarus:reset_password' %}" method="post" class="form" novalidate>
{% csrf_token %}
{% for field in form %}
{% bootstrap_field field show_label=False type='fields'%}
{% endfor %}
<p>{{form.non_field_errors|striptags}}</p>
<button type="submit" class="btn btn-primary btn-blue">Send Email</button>
</form>
<br>
<div class="notice-box">
<p class="order-bottom-text">Still have trouble? Contact us for technical support.</p>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"></div>
</div>
</div>
</section>
<section id="contact">
<div class="fill">
<div class="row" class="wow fadeInDown">
<div class="col-lg-12 text-center wow fadeInDown">
<div class="col-md-4 map-title">
Digital Glarus<br>
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
<br>info@digitalglarus.ch
<br>
(044) 534-66-22
<p>&nbsp;</p>
</span>
</div>
<p>&nbsp;</p>
</div>
</div>
</div>
</section>
{% endblock %}

View file

@ -0,0 +1,59 @@
{% extends "new_base_glarus.html" %}
{% load staticfiles cms_tags bootstrap3%}
{% block title %}crowdfunding{% endblock %}
{% block content %}
<section id="price">
<div class="signup-container">
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"> </div>
<div class="col-xs-12 col-sm-6 col-lg-4 text-center wow fadeInDown">
<div class="signup-box">
<span class="glyphicon glyphicon-plus"></span>
<h2 class="section-heading">Sign up</h2>
<h2 class="signup-lead">Start coworking at Digital Glarus! <br> Membership costs only
<strong>35CHF</strong> per month.<br> 2 free working days included!</h2>
<hr class="primary">
<div class="signup-form form-group row">
<form action="{% url 'digitalglarus:signup' %}" method="post" class="form" novalidate>
{% csrf_token %}
<input type="hidden" name="" value="{{ request.GET.next }}">
{% for field in form %}
{% bootstrap_field field show_label=False type='fields'%}
{% endfor %}
<p>{{form.non_field_errors|striptags}}</p>
<button type="submit" class="btn btn-primary btn-blue">Signup</button>
</form>
<br>
<div class="notice-box">
<p class="signup-text">Already a member?<a href=#login>Log in</a></p>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3 col-lg-4 text-center wow fadeInDown"></div>
</div>
</div>
</section>
<section id="contact">
<div class="fill">
<div class="row" class="wow fadeInDown">
<div class="col-lg-12 text-center wow fadeInDown">
<div class="col-md-4 map-title">
Digital Glarus<br>
<span class="map-caption">In der Au 7 Schwanden 8762 Switzerland
<br>info@digitalglarus.ch
<br>
(044) 534-66-22
<p>&nbsp;</p>
</span>
</div>
<p>&nbsp;</p>
</div>
</div>
</div>
</section>
{% endblock %}

View file

@ -1,6 +1,5 @@
{% load static %}
{% load bootstrap3 %}
{% load staticfiles cms_tags menu_tags sekizai_tags menu_tags %}
{% load staticfiles cms_tags menu_tags sekizai_tags menu_tags bootstrap3 %}
{% load i18n %}
<!DOCTYPE html>
<html lang="en">
@ -25,6 +24,7 @@
<link href="{% static 'digitalglarus/css/agency.css' %}" rel="stylesheet">
<link href="{% static 'digitalglarus/css/ungleich.css' %}" rel="stylesheet">
<link href="{% static 'digitalglarus/css/history.css' %}" rel="stylesheet">
<link href="{% static 'digitalglarus/css/price.css' %}" rel="stylesheet">
<!-- <link href="css/bootstrap.min.css" rel="stylesheet"> -->
<link href="{% static 'digitalglarus/css/lib/animate.min.css' %}" rel="stylesheet">
<!-- <link href="{% static 'css/membership.css' %}" rel="stylesheet"> -->
@ -136,15 +136,24 @@
<!-- jQuery -->
<script src="{% static 'digitalglarus/js/jquery.js' %}"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.validation/1.13.1/jquery.validate.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="{% static 'digitalglarus/js/bootstrap.min.js' %}"></script>
<!-- Plugin JavaScript -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="{% static 'digitalglarus/js/classie.js' %}"></script>
<script src="{% static 'digitalglarus/js/cbpAnimatedHeader.js' %}"></script>
<!-- Stripe Lib -->
<script type="text/javascript" src="//js.stripe.com/v2/"></script>
<!-- Proccess payment lib -->
<script src="{% static 'digitalglarus/js/payment.js' %}"></script>
<!-- Contact Form JavaScript -->
<script src="{% static 'digitalglarus/js/jqBootstrapValidation.js' %}"></script>
@ -156,6 +165,8 @@
<script src="{% static 'digitalglarus/js/ungleich.js' %}"></script>
<!-- Custom Fonts -->
<link href="//fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">
<link href="{% static 'digitalglarus/font-awesome-4.1.0/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">

View file

@ -2,14 +2,20 @@ from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from . import views
from .views import ContactView, IndexView, AboutView, HistoryView
from membership.views import LoginRegistrationView
from .views import ContactView, IndexView, AboutView, HistoryView, LoginView, SignupView,\
PasswordResetView, PasswordResetConfirmView, MembershipPaymentView
# from membership.views import LoginRegistrationView
urlpatterns = [
url(_(r'^$'), IndexView.as_view(), name='landing'),
url(_(r'contact/?$'), ContactView.as_view(), name='contact'),
url(_(r'login/?$'), LoginRegistrationView.as_view(), name='login'),
url(_(r'login/?$'), LoginView.as_view(), name='login'),
url(_(r'signup/?$'), SignupView.as_view(), name='signup'),
url(r'reset-password/?$', PasswordResetView.as_view(), name='reset_password'),
url(r'reset-password-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$',
PasswordResetConfirmView.as_view(), name='reset_password_confirm'),
url(_(r'history/?$'), HistoryView.as_view(), name='history'),
url(_(r'membership/payment?$'), MembershipPaymentView.as_view(), name='membership_payment'),
url(_(r'supporters/?$'), views.supporters, name='supporters'),
url(r'calendar_api/(?P<month>\d+)/(?P<year>\d+)?$', views.CalendarApi.as_view(),name='calendar_api_1'),
url(r'calendar_api/', views.CalendarApi.as_view(),name='calendar_api'),

View file

@ -1,11 +1,14 @@
import json
import datetime
from django.conf import settings
from django.shortcuts import get_object_or_404, render
from django.forms import ModelForm
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse_lazy
from django.core.urlresolvers import reverse_lazy, reverse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.translation import get_language
from djangocms_blog.models import Post
from django.contrib import messages
@ -16,11 +19,117 @@ from .models import Supporter
from utils.forms import ContactUsForm
from django.views.generic.edit import FormView
from membership.calendar.calendar import BookCalendar
from membership.models import Calendar as CalendarModel
import json
from django.contrib.auth import logout
from membership.models import Calendar as CalendarModel, CustomUser, StripeCustomer
from utils.views import LoginViewMixin, SignupViewMixin, \
PasswordResetViewMixin, PasswordResetConfirmViewMixin
from utils.forms import PasswordResetRequestForm
from utils.stripe_utils import StripeUtils
from .forms import LoginForm, SignupForm, MembershipBillingForm
from .models import MembershipType
class IndexView(TemplateView):
template_name = "digitalglarus/old_index.html"
class LoginView(LoginViewMixin):
template_name = "digitalglarus/login.html"
form_class = LoginForm
success_url = reverse_lazy('digitalglarus:landing')
class SignupView(SignupViewMixin):
template_name = "digitalglarus/signup.html"
form_class = SignupForm
success_url = reverse_lazy('digitalglarus:login')
class PasswordResetView(PasswordResetViewMixin):
template_name = 'digitalglarus/reset_password.html'
success_url = reverse_lazy('digitalglarus:login')
form_class = PasswordResetRequestForm
template_email_path = 'digitalglarus/emails/'
class PasswordResetConfirmView(PasswordResetConfirmViewMixin):
template_name = 'digitalglarus/confirm_reset_password.html'
success_url = reverse_lazy('digitalglarus:login')
class HistoryView(TemplateView):
template_name = "digitalglarus/history.html"
def get_context_data(self, **kwargs):
context = super(HistoryView, self).get_context_data(**kwargs)
supporters = Supporter.objects.all()
context.update({
'supporters': supporters
})
return context
class MembershipPaymentView(LoginRequiredMixin, FormView):
template_name = "digitalglarus/membership_payment.html"
login_url = reverse_lazy('digitalglarus:login')
form_class = MembershipBillingForm
def get_form_kwargs(self):
membership_type = MembershipType.objects.get(name='standard')
form_kwargs = super(MembershipPaymentView, self).get_form_kwargs()
form_kwargs.update({
'initial': {'membership_type': membership_type.id}
})
return form_kwargs
def get_context_data(self, **kwargs):
context = super(MembershipPaymentView, self).get_context_data(**kwargs)
context.update({
'stripe_key': settings.STRIPE_API_PUBLIC_KEY
})
return context
def post(self, request, *args, **kwargs):
import pdb;pdb.set_trace()
form = self.get_form()
if form.is_valid():
data = form.cleaned_data
context = self.get_context_data()
token = data.get('token')
membership_type = data.get('membership_type')
# Get or create stripe customer
customer = StripeCustomer.get_or_create(email=self.request.user.email,
token=token)
if not customer:
form.add_error("__all__", "Invalid credit card")
return self.render_to_response(self.get_context_data(form=form))
# Make stripe charge to a customer
stripe_utils = StripeUtils()
charge_response = stripe_utils.make_charge(amount=membership_type.price,
customer=customer.stripe_id)
charge = charge_response.get('response_object')
# Check if the payment was approved
if not charge:
context.update({
'paymentError': charge_response.get('error'),
'form': form
})
return render(request, self.template_name, context)
charge = charge_response.get('response_object')
else:
return self.form_invalid(form)
############## OLD VIEWS
class CalendarApi(View):
def get(self,request,month,year):
calendar = BookCalendar(request.user,requested_month=month).formatmonth(int(year),int(month))
@ -46,21 +155,6 @@ class ContactView(FormView):
return super(ContactView, self).form_valid(form)
class IndexView(TemplateView):
template_name = "digitalglarus/old_index.html"
class HistoryView(TemplateView):
template_name = "digitalglarus/history.html"
def get_context_data(self, **kwargs):
context = super(HistoryView, self).get_context_data(**kwargs)
supporters = Supporter.objects.all()
context.update({
'supporters': supporters
})
return context
class AboutView(TemplateView):
template_name = "digitalglarus/about.html"

View file

@ -56,7 +56,7 @@ $( document ).ready(function() {
//set token on a hidden input
$('#id_token').val(token);
$('#donation-form').submit();
$('#billing-form').submit();
}
});
}

View file

@ -17,7 +17,7 @@ from stored_messages.api import mark_read
from membership.models import CustomUser, StripeCustomer
from utils.stripe_utils import StripeUtils
from utils.forms import BillingAddressForm, PasswordResetRequestForm
from utils.views import PasswordResetViewMixin, PasswordResetConfirmViewMixin
from utils.views import PasswordResetViewMixin, PasswordResetConfirmViewMixin, LoginViewMixin
from utils.mailer import BaseEmail
from .models import VirtualMachineType, VirtualMachinePlan, HostingOrder
from .forms import HostingUserSignupForm, HostingUserLoginForm
@ -137,31 +137,10 @@ class IndexView(View):
return render(request, self.template_name, context)
class LoginView(FormView):
template_name = 'hosting/login.html'
success_url = reverse_lazy('hosting:orders')
class LoginView(LoginViewMixin):
template_name = "hosting/login.html"
form_class = HostingUserLoginForm
moodel = CustomUser
def get_success_url(self):
next_url = self.request.session.get('next', self.success_url)
return next_url
def form_valid(self, form):
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
auth_user = authenticate(email=email, password=password)
if auth_user:
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
return HttpResponseRedirect(self.get_success_url())
def get(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
return HttpResponseRedirect(reverse('hosting:notifications'))
return super(LoginView, self).get(request, *args, **kwargs)
success_url = reverse_lazy('hosting:orders')
class SignupView(CreateView):
@ -196,32 +175,6 @@ class PasswordResetConfirmView(PasswordResetConfirmViewMixin):
template_name = 'hosting/confirm_reset_password.html'
success_url = reverse_lazy('hosting:login')
# def post(self, request, uidb64=None, token=None, *arg, **kwargs):
# try:
# uid = urlsafe_base64_decode(uidb64)
# user = CustomUser.objects.get(pk=uid)
# except (TypeError, ValueError, OverflowError, CustomUser.DoesNotExist):
# user = None
# form = self.form_class(request.POST)
# if user is not None and default_token_generator.check_token(user, token):
# if form.is_valid():
# new_password = form.cleaned_data['new_password2']
# user.set_password(new_password)
# user.save()
# messages.success(request, 'Password has been reset.')
# return self.form_valid(form)
# else:
# messages.error(request, 'Password reset has not been unsuccessful.')
# form.add_error(None, 'Password reset has not been unsuccessful.')
# return self.form_invalid(form)
# else:
# messages.error(request, 'The reset password link is no longer valid.')
# form.add_error(None, 'Password reset has not been unsuccessful.')
# return self.form_invalid(form)
class NotificationsView(LoginRequiredMixin, TemplateView):
template_name = 'hosting/notifications.html'

View file

@ -4,19 +4,6 @@
{% block content %}
<style type="text/css">
.navbar-default {
background-color: black;
}
section.login {
margin-top: 10%;
margin-bottom: 8%;
}
</style>
<section class="login">
<div class="container">
<div class="row">

View file

@ -1,17 +1,17 @@
from django.views.generic import TemplateView, CreateView, FormView, DetailView, UpdateView,\
from django.views.generic import TemplateView, FormView, DetailView, UpdateView,\
ListView
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.core.urlresolvers import reverse_lazy, reverse
from django.contrib.auth import authenticate, login
from django.contrib.auth.mixins import LoginRequiredMixin
from django.conf import settings
from django.contrib import messages
from membership.models import CustomUser, StripeCustomer
from membership.models import StripeCustomer
from utils.stripe_utils import StripeUtils
from utils.views import PasswordResetViewMixin, PasswordResetConfirmViewMixin
from utils.views import PasswordResetViewMixin, PasswordResetConfirmViewMixin, LoginViewMixin,\
SignupViewMixin
from utils.forms import PasswordResetRequestForm
from utils.mailer import BaseEmail
@ -36,53 +36,16 @@ class LandingView(TemplateView):
return context
class LoginView(FormView):
class LoginView(LoginViewMixin):
template_name = "nosystemd/login.html"
form_class = LoginForm
success_url = reverse_lazy('nosystemd:landing')
def get_success_url(self):
next_url = self.request.session.get('next', self.success_url)
return next_url
def form_valid(self, form):
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
auth_user = authenticate(email=email, password=password)
if auth_user:
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
return HttpResponseRedirect(self.get_success_url())
def get(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
return HttpResponseRedirect(reverse('nosystemd:landing'))
return super(LoginView, self).get(request, *args, **kwargs)
class SignupView(CreateView):
template_name = 'nosystemd/signup.html'
model = CustomUser
class SignupView(SignupViewMixin):
template_name = "nosystemd/signup.html"
form_class = SignupForm
def get_success_url(self):
next_url = self.request.POST.get('next', reverse('nosystemd:login'))
return next_url
def form_valid(self, form):
name = form.cleaned_data.get('name')
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
CustomUser.register(name, password, email)
auth_user = authenticate(email=email, password=password)
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
success_url = reverse_lazy('nosystemd:landing')
class PasswordResetView(PasswordResetViewMixin):

View file

@ -1,10 +1,10 @@
from django.views.generic import FormView
from django.views.generic import FormView, CreateView
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.contrib import messages
from django.contrib.auth.tokens import default_token_generator
from django.utils.encoding import force_bytes
from django.http import HttpResponseRedirect
from django.contrib.auth import authenticate, login
from membership.models import CustomUser
@ -12,6 +12,52 @@ from .mailer import BaseEmail
from .forms import SetPasswordForm
class SignupViewMixin(CreateView):
model = CustomUser
success_url = None
def get_success_url(self):
next_url = self.request.POST.get('next', self.success_url)
return next_url
def form_valid(self, form):
name = form.cleaned_data.get('name')
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
CustomUser.register(name, password, email)
auth_user = authenticate(email=email, password=password)
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
class LoginViewMixin(FormView):
success_url = None
def get_success_url(self):
next_url = self.request.session.get('next', self.success_url)
return next_url
def form_valid(self, form):
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
auth_user = authenticate(email=email, password=password)
if auth_user:
login(self.request, auth_user)
return HttpResponseRedirect(self.get_success_url())
return HttpResponseRedirect(self.get_success_url())
def get(self, request, *args, **kwargs):
if self.request.user.is_authenticated():
return HttpResponseRedirect(self.get_success_url())
return super(LoginViewMixin, self).get(request, *args, **kwargs)
class PasswordResetViewMixin(FormView):
# template_name = 'hosting/reset_password.html'
# form_class = PasswordResetRequestForm
@ -72,11 +118,11 @@ class PasswordResetConfirmViewMixin(FormView):
messages.success(request, 'Password has been reset.')
return self.form_valid(form)
else:
messages.error(request, 'Password reset has not been unsuccessful.')
form.add_error(None, 'Password reset has not been unsuccessful.')
messages.error(request, 'Password reset has not been successful.')
form.add_error(None, 'Password reset has not been successful.')
return self.form_invalid(form)
else:
messages.error(request, 'The reset password link is no longer valid.')
form.add_error(None, 'Password reset has not been unsuccessful.')
form.add_error(None, 'The reset password link is no longer valid.')
return self.form_invalid(form)