Browse Source

Add registration

Ian Adam Naval 5 years ago
parent
commit
dcf9cc14f2

+ 15
- 1
librebudget/settings.py View File

@@ -34,9 +34,11 @@ INSTALLED_APPS = (
34 34
     'django.contrib.auth',
35 35
     'django.contrib.contenttypes',
36 36
     'django.contrib.sessions',
37
+    'django.contrib.sites',
37 38
     'django.contrib.messages',
38 39
     'django.contrib.staticfiles',
39
-    'librebudget_core'
40
+    'registration',
41
+    'librebudget_core',
40 42
 )
41 43
 
42 44
 MIDDLEWARE_CLASSES = (
@@ -54,6 +56,11 @@ ROOT_URLCONF = 'librebudget.urls'
54 56
 WSGI_APPLICATION = 'librebudget.wsgi.application'
55 57
 
56 58
 
59
+# Site
60
+
61
+SITE_ID = 1
62
+
63
+
57 64
 # Database
58 65
 # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
59 66
 
@@ -82,3 +89,10 @@ USE_TZ = True
82 89
 # https://docs.djangoproject.com/en/1.7/howto/static-files/
83 90
 
84 91
 STATIC_URL = '/static/'
92
+
93
+
94
+# Registration
95
+
96
+ACCOUNT_ACTIVATION_DAYS = 1
97
+
98
+LOGIN_REDIRECT_URL = '/'

+ 1
- 0
librebudget/urls.py View File

@@ -5,4 +5,5 @@ urlpatterns = patterns(
5 5
     '',
6 6
     url(r'', include('librebudget_core.urls')),
7 7
     url(r'^admin/', include(admin.site.urls)),
8
+    url(r'^accounts/', include('registration.urls')),
8 9
 )

+ 8
- 0
librebudget_core/static/css/main.css View File

@@ -0,0 +1,8 @@
1
+body {
2
+	padding-top: 50px;
3
+	padding-bottom: 20px;
4
+}
5
+
6
+nav + .container {
7
+	margin-top: 16px;
8
+}

+ 1
- 0
librebudget_core/templates/base.html View File

@@ -0,0 +1 @@
1
+{% extends 'librebudget_core/layout.html' %}

+ 5
- 37
librebudget_core/templates/librebudget_core/index.html View File

@@ -5,10 +5,6 @@
5 5
 	<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.1.1/gh-fork-ribbon.min.css" />
6 6
 	<style type="text/css">
7 7
 		/* Move down content because we have a fixed navbar that is 50px tall */
8
-		body {
9
-			padding-top: 50px;
10
-			padding-bottom: 20px;
11
-		}
12 8
 		.icon {
13 9
 			float: right;
14 10
 			width: 32px;
@@ -18,37 +14,9 @@
18 14
 {% endblock css %}
19 15
 
20 16
 {% block main %}
21
-	<!-- Fork me logo -->
22
-	<div class="github-fork-ribbon-wrapper right">
23
-		<div class="github-fork-ribbon">
24
-			<a href="https://git.ianonavy.com/ianonavy/librebudget">Fork me on Gogs</a>
25
-		</div>
26
-	</div>
27
-	<!-- Main jumbotron for a primary marketing message or call to action -->
28
-	<div class="jumbotron">
29
-		<div class="container">
30
-			<h1>Creating a budget is easy.</h1>
31
-			<p>Sticking to one is hard. LibreBudget keeps track of your transactions so you don't have to.</p>
32
-			<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p>
33
-		</div>
34
-	</div>
35
-
36
-	<div class="container">
37
-		<div class="row">
38
-			<div class="col-md-4">
39
-				<h2>Free <img class="icon" src="{% static 'img/key162.png' %}" alt="key"></h2>
40
-				<p>Free as in free beer and free speech. Potato kerr's pink cabritas shepody kennebec. Langlade tater yukon gold vitelotte goldrush irish cobbler atlantic. Tater kipfler arran victory irish cobbler marcy primura, french fries up to date spud anya arran victory snowden.</p>
41
-				<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
42
-			</div>
43
-			<div class="col-md-4">
44
-				<h2>Fast <img class="icon" src="{% static 'img/sprint.png' %}" alt="key"></h2>
45
-				<p>Red norland amandine flava silverton russet arran victory marquis. Kestrel bannock russet, camota flava bintje home guard silverton russet bonnotte monalisa. Flava record bonnotte linda russet burbank innovator. Jersey royal bildtstar chelina flava atlantic kestrel.</p>
46
-				<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
47
-			</div>
48
-			<div class="col-md-4">
49
-				<h2>Secure <img class="icon" src="{% static 'img/shield20.png' %}" alt="key"></h2>
50
-				<p>Norgold russet french fries atlantic stobrawa sirco german butterball. Annabelle blue congo russet burbank keuka gold, silverton russet golden wonder irish cobbler annabelle pike. Langlade shepody up to date cielo yukon gold, linda red lasoda yellow finn blue congo superior.</p>
51
-				<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
52
-			</div>
53
-		</div>
17
+	{% if user and user.is_authenticated and user.is_active %}
18
+	{% include 'librebudget_core/index_member.html' %}
19
+	{% else %}
20
+	{% include 'librebudget_core/index_guest.html' %}
21
+	{% endif %}
54 22
 {% endblock main %}

+ 36
- 0
librebudget_core/templates/librebudget_core/index_guest.html View File

@@ -0,0 +1,36 @@
1
+{% load staticfiles %}
2
+
3
+	<!-- Fork me logo -->
4
+	<div class="github-fork-ribbon-wrapper right">
5
+		<div class="github-fork-ribbon">
6
+			<a href="https://git.ianonavy.com/ianonavy/librebudget">Fork me on Gogs</a>
7
+		</div>
8
+	</div>
9
+	<!-- Main jumbotron for a primary marketing message or call to action -->
10
+	<div class="jumbotron">
11
+		<div class="container">
12
+			<h1>Creating a budget is easy.</h1>
13
+			<p>Sticking to one is hard. LibreBudget keeps track of your transactions so you don't have to.</p>
14
+			<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p>
15
+		</div>
16
+	</div>
17
+
18
+	<div class="container">
19
+		<div class="row">
20
+			<div class="col-md-4">
21
+				<h2>Free <img class="icon" src="{% static 'img/key162.png' %}" alt="key"></h2>
22
+				<p>Free as in free beer and free speech. Potato kerr's pink cabritas shepody kennebec. Langlade tater yukon gold vitelotte goldrush irish cobbler atlantic. Tater kipfler arran victory irish cobbler marcy primura, french fries up to date spud anya arran victory snowden.</p>
23
+				<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
24
+			</div>
25
+			<div class="col-md-4">
26
+				<h2>Fast <img class="icon" src="{% static 'img/sprint.png' %}" alt="key"></h2>
27
+				<p>Red norland amandine flava silverton russet arran victory marquis. Kestrel bannock russet, camota flava bintje home guard silverton russet bonnotte monalisa. Flava record bonnotte linda russet burbank innovator. Jersey royal bildtstar chelina flava atlantic kestrel.</p>
28
+				<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
29
+			</div>
30
+			<div class="col-md-4">
31
+				<h2>Secure <img class="icon" src="{% static 'img/shield20.png' %}" alt="key"></h2>
32
+				<p>Norgold russet french fries atlantic stobrawa sirco german butterball. Annabelle blue congo russet burbank keuka gold, silverton russet golden wonder irish cobbler annabelle pike. Langlade shepody up to date cielo yukon gold, linda red lasoda yellow finn blue congo superior.</p>
33
+				<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
34
+			</div>
35
+		</div>
36
+	</div>

+ 8
- 0
librebudget_core/templates/librebudget_core/index_member.html View File

@@ -0,0 +1,8 @@
1
+{% load staticfiles %}
2
+	<div class="container">
3
+		<div class="row">
4
+			<div class="col-md-12">
5
+				<h1>Account Summary</h1>
6
+			</div>
7
+		</div>
8
+	</div>

+ 21
- 5
librebudget_core/templates/librebudget_core/layout.html View File

@@ -7,6 +7,7 @@
7 7
 	<title>LibreBudget</title>
8 8
 
9 9
 	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
10
+	<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}">
10 11
 	{% block css %}{% endblock css %}
11 12
 
12 13
 	<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
@@ -30,29 +31,44 @@
30 31
 				</a>
31 32
 			</div>
32 33
 			<div id="navbar" class="navbar-collapse collapse">
33
-				<form class="navbar-form navbar-right">
34
+				{% if user and user.is_authenticated and user.is_active %}
35
+				<ul class="nav navbar-nav navbar-right">
36
+					<li><a href="{% url 'auth_logout' %}">Sign out</a></li>
37
+				</ul>
38
+				{% else %}
39
+				<form class="navbar-form navbar-right" action="{% url 'auth_login' %}" method="POST">
40
+					{% csrf_token %}
34 41
 					<div class="form-group">
35
-						<input type="text" placeholder="Email" class="form-control">
42
+						<input type="text" placeholder="Username" class="form-control" name="username">
36 43
 					</div>
37 44
 					<div class="form-group">
38
-						<input type="password" placeholder="Password" class="form-control">
45
+						<input type="password" placeholder="Password" class="form-control" name="password">
39 46
 					</div>
40 47
 					<button type="submit" class="btn btn-success">Sign in</button>
41 48
 				</form>
49
+				{% endif %}
42 50
 			</div><!--/.navbar-collapse -->
43 51
 		</div>
44 52
 	</nav>
45 53
 
46 54
 	{% block main %}
55
+	<div class="container">
56
+		<div class="row">
57
+			<div class="col-sm-12">
58
+				{% block content %}
59
+				{% endblock content %}
60
+			</div>
61
+		</div>
62
+	</div>
47 63
 	{% endblock main %}
48 64
 
49 65
 		<hr>
50
-
66
+	<div class="container">
51 67
 		<footer>
52 68
 			<p>Copyright &copy; <a href="//ianonavy.com">Ian Adam Naval</a> 2015. All rights reserved.</p>
53 69
 			<div>Icons made by <a href="http://www.flaticon.com/authors/yannick" title="Yannick">Yannick</a>, <a href="http://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a>             is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0">CC BY 3.0</a></div>
54 70
 		</footer>
55
-	</div> <!-- /container -->
71
+	</div>
56 72
 
57 73
 	<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
58 74
 	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

+ 0
- 4
requirements.txt View File

@@ -1,4 +0,0 @@
1
-django==1.8.1
2
-selenium==2.45.0
3
-beautifulsoup4==4.3.2
4
-django-dotenv==1.3.0

+ 15
- 7
setup.py View File

@@ -1,9 +1,17 @@
1 1
 from distutils.core import setup
2 2
 
3
-setup(name='librebudget',
4
-      version='0.1',
5
-      description='Free personal finance tool',
6
-      author='Ian Adam Naval',
7
-      author_email='ianonavy@gmail.com',
8
-      url='https://git.ianonavy.com/ianonavy/librebudget',
9
-      packages=['librebudget', 'librebudget_core'])
3
+setup(
4
+    name='librebudget',
5
+    version='0.1',
6
+    description='Free personal finance tool',
7
+    author='Ian Adam Naval',
8
+    author_email='ianonavy@gmail.com',
9
+    url='https://git.ianonavy.com/ianonavy/librebudget',
10
+    install_requires=[
11
+        "django==1.8.1",
12
+        "selenium==2.45.0",
13
+        "beautifulsoup4==4.3.2",
14
+        "django-dotenv==1.3.0",
15
+        "django-registration-redux==1.2",
16
+    ],
17
+    packages=['librebudget', 'librebudget_core'])

Loading…
Cancel
Save