Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo committed Feb 3, 2014
0 parents commit c6d713e
Show file tree
Hide file tree
Showing 478 changed files with 85,824 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.pyc
django_app/Procfile
django_app/project/settings_prod.py
nodejs_app/Procfile
.settings/
.project
.pydevproject
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Dyapos - A tool for creating beautiful HTML5+CSS3 presentations based on Impress.js.

Copyright (c) 2013 Edwardoyarzun

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Dyapos

## Test Dyapos here: [dyapos.heroku.com](http://dyapos.heroku.com)

# License

Copyright (c) 2013 Edwardoyarzun

Released under the GPL License.
2 changes: 2 additions & 0 deletions django_app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
venv
Empty file added django_app/main/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions django_app/main/backends.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from django.contrib.auth.models import User, check_password

class EmailAuthBackend(object):
"""
Email Authentication Backend
Allows a user to sign in using an email/password pair rather than
a username/password pair.
"""

def authenticate(self, username=None, password=None):
""" Authenticate a user based on email address as the user name. """
try:
user = User.objects.get(email=username)
if user.check_password(password):
return user
except User.DoesNotExist:
return None

def get_user(self, user_id):
""" Get a User object from the user_id. """
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None
34 changes: 34 additions & 0 deletions django_app/main/fixtures/initial_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"model": "main.theme",
"pk": 1,
"fields": {
"name": "Default Theme",
"is_custom": 0
}
},
{
"model": "main.theme",
"pk": 2,
"fields": {
"name": "Green Theme",
"is_custom": 0
}
},
{
"model": "main.theme",
"pk": 3,
"fields": {
"name": "Blue Theme",
"is_custom": 0
}
},
{
"model": "main.theme",
"pk": 4,
"fields": {
"name": "Coffee",
"is_custom": 0
}
}
]
3 changes: 3 additions & 0 deletions django_app/main/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from main.forms.user import *
from main.forms.presentation import *
from main.forms.comment import *
6 changes: 6 additions & 0 deletions django_app/main/forms/comment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django import forms

class CommentForm(forms.Form):
presentation_id = forms.IntegerField(widget=forms.HiddenInput)
comment = forms.CharField(widget=forms.Textarea,
max_length=500)
22 changes: 22 additions & 0 deletions django_app/main/forms/presentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django import forms
from django.utils.translation import ugettext_lazy as _

class NewPresentationForm(forms.Form):
name = forms.CharField(max_length=20)
description = forms.CharField(required=False,
widget=forms.Textarea,
max_length=200)
is_private = forms.BooleanField(required=False,
label=_("is_private"))

class RenameForm(forms.Form):
name = forms.CharField(max_length=20)

class ModifyDescriptionForm(forms.Form):
description = forms.CharField(required=False,
widget=forms.Textarea,
max_length=200)

class SharePresentationForm(forms.Form):
email = forms.EmailField()
permission = forms.ChoiceField(choices=(("1", _("option_allow_edit")), ("0", _("option_view_only"))))
81 changes: 81 additions & 0 deletions django_app/main/forms/user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _

class SignupForm(forms.Form):
first_name = forms.CharField(min_length=3,
max_length=20)
last_name = forms.CharField(min_length=3,
max_length=20)
email = forms.EmailField()
password = forms.CharField(widget=forms.PasswordInput)
password_repeat = forms.CharField(widget=forms.PasswordInput)

def clean(self):
# Check if passwords match
password1 = self.cleaned_data.get('password')
password2 = self.cleaned_data.get('password_repeat')

if password1 != password2:
raise forms.ValidationError(_("error_passwords_dont_match"))

# Check if email already exists
if User.objects.filter(email=self.cleaned_data.get("email")).exists():
raise forms.ValidationError(_("error_email_already_registered"))

return self.cleaned_data

class LoginForm(forms.Form):
email = forms.EmailField()
password = forms.CharField(widget=forms.PasswordInput)

def clean(self):
# Validate authentication
email = self.cleaned_data.get("email")
password = self.cleaned_data.get("password")
if(email and password):
user = authenticate(username=email, password=password)

'''If email and password are correct, it will return an User object
So if not it will return None'''
if user is None:
raise forms.ValidationError(_("error_user_or_password_incorrect"))
else:
# if user is acive
if not user.is_active:
raise forms.ValidationError(_("error_account_not_activated"))

return self.cleaned_data

class RecoverPasswordForm(forms.Form):
email = forms.EmailField()

def clean(self):
# Check if the email address is associated to an account
email = self.cleaned_data.get("email")
if email:
if not User.objects.filter(email=email).exists():
raise forms.ValidationError(_("error_email_not_registered"))

return self.cleaned_data

class ChangePasswordForm(forms.Form):
old_password = forms.CharField(widget=forms.PasswordInput)
new_password = forms.CharField(widget=forms.PasswordInput)
new_password_repeat = forms.CharField(widget=forms.PasswordInput)

def clean(self):
# Check if passwords match
new_password1 = self.cleaned_data.get("new_password")
new_password2 = self.cleaned_data.get("new_password_repeat")

if new_password1 != new_password2:
raise forms.ValidationError(_("error_passwords_dont_match"))

return self.cleaned_data

class ProfileForm(forms.Form):
first_name = forms.CharField(max_length=15)
last_name = forms.CharField(max_length=15)
email = forms.EmailField()
Binary file added django_app/main/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit c6d713e

Please sign in to comment.