Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #14

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Dev #14

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
adb97e6
Merge branch 'frontend' of https://github.com/zuri-training/Auth_wiki…
Gorgeous-me-tomi Dec 12, 2022
a2cf2c5
[feat] :- Deleted files from client folder
Gorgeous-me-tomi Dec 12, 2022
6229d5e
[feat]:- Added new dependencies to requirement file
Gorgeous-me-tomi Dec 12, 2022
e7ce06a
[feat] :- Added templates to django acct app
Gorgeous-me-tomi Dec 12, 2022
ab21a5d
[feat] :- Added css files and images to static folder in django acct app
Gorgeous-me-tomi Dec 12, 2022
c3572fb
[feat] :- Created models for account app
Gorgeous-me-tomi Dec 12, 2022
f9e5b11
[feat] :- Created forms for account app
Gorgeous-me-tomi Dec 12, 2022
214f055
[feat] :- Registered acct models
Gorgeous-me-tomi Dec 12, 2022
9a5080c
[feat] :- Created views for auth_wiki account app
Gorgeous-me-tomi Dec 12, 2022
890b103
[feat] :- Created urls for auth_wiki account app
Gorgeous-me-tomi Dec 12, 2022
66a21be
[feat] :- migrations auth_wiki account app
Gorgeous-me-tomi Dec 12, 2022
fbdfaa5
[feat] :- setting urls and other settings for auth_wiki app
Gorgeous-me-tomi Dec 12, 2022
0ed39c8
[feat] :- Created models for auth_wiki library app
Gorgeous-me-tomi Dec 12, 2022
b771827
[feat] :- Created forms for auth_wiki library app
Gorgeous-me-tomi Dec 12, 2022
c19fae4
[feat] :-Registered library models for auth_wiki app
Gorgeous-me-tomi Dec 12, 2022
6bb151a
[feat] :- Created views and urls for auth_wiki library app
Gorgeous-me-tomi Dec 12, 2022
7971c50
[feat] :- Added serializers for library app
Gorgeous-me-tomi Dec 12, 2022
f77781c
[feat] :-migrations for library app
Gorgeous-me-tomi Dec 12, 2022
3b9fea3
[feat] :-Added images and css file for library app
Gorgeous-me-tomi Dec 12, 2022
b2ff555
[feat] :- added html files to library app templates folder
Gorgeous-me-tomi Dec 12, 2022
a4bddf0
Merge branch 'dev' of https://github.com/zuri-training/Auth_wiki-Team…
Gorgeous-me-tomi Dec 12, 2022
f3d53c2
Merge pull request #10 from zuri-training/merged
timmySpark Dec 13, 2022
2b819a4
refactored and fixed acct logic
Gorgeous-me-tomi Dec 14, 2022
e9b7dfd
configuring apps details
Gorgeous-me-tomi Dec 14, 2022
24cef9b
creating designs and logic for library app
Gorgeous-me-tomi Dec 14, 2022
f5866f9
Merge pull request #11 from zuri-training/merged
Gorgeous-me-tomi Dec 14, 2022
4c44608
authenticated
asgatcreation Dec 14, 2022
9c36bc4
new account
asgatcreation Dec 14, 2022
94c35bc
newdev to dev
asgatcreation Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Created by https://www.toptal.com/developers/gitignore/api/django
# Edit at https://www.toptal.com/developers/gitignore?templates=django
local

### Django ###
*.log
Expand Down
12 changes: 10 additions & 2 deletions auth_wiki/account/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from django.contrib import admin
from .models import *
from .models import Profile

# Register your models here.
admin.site.register(Profile)



class ProfileAdmin(admin.ModelAdmin):
list_display = ('user','first_name','last_name','gender',)
search_fields = ('user',)


admin.site.register(Profile, ProfileAdmin)
34 changes: 8 additions & 26 deletions auth_wiki/account/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django import forms
from django.forms import ModelForm
from . import views
from .models import *
from . import models


class NewUserForm(UserCreationForm):
Expand All @@ -14,7 +14,7 @@ class NewUserForm(UserCreationForm):

class Meta:
model=User
fields=["username","email","password1","password2"]
fields=("username","email","password1","password2")


def save(self, commit=True):
Expand All @@ -26,28 +26,10 @@ def save(self, commit=True):

class ProfileForm(ModelForm):
class Meta:
model= Profile
model= models.Profile
fields=['user','first_name','last_name','gender','image','contact_number'] #'created_on', 'updated_on']

class UpdateUserForm(ModelForm):
username = forms.CharField(max_length=100,
required=True,
widget=forms.TextInput(attrs={'class': 'form-control'}))
email = forms.EmailField(required=True,
widget=forms.EmailInput(attrs={'class': 'form-control'}))

class Meta:
model = User
fields = ['username', 'email']


class UpdateProfileForm(ModelForm):
image = forms.ImageField(widget=forms.FileInput(attrs={'class': 'form-control-file'}))
first_name = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}))
last_name = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}))
gender = forms.ChoiceField(choices= GENDER_CHOICES)
# bio = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 5}))
contact_number = forms.CharField(widget=forms.NumberInput(attrs={'class':'form-control'}))
class Meta:
model= Profile
fields = '__all__'





26 changes: 26 additions & 0 deletions auth_wiki/account/templates/account/password_reset.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends 'base.html' %}
{% block title %} Auth Wiki - Sign Up {% endblock %}


{% block content %}
{% load crispy_forms_tags %}
<div class="col-12 col-lg-6">
<img class="main-img" src="https://wallpapercave.com/dwp1x/wp26286.jpg" alt="">
</div>

<div class="col-12 col-lg-6 main-form" style="padding: 100px 50px 100px 20px;">
<div class="border rounded p-4 w-80 d-flex justify-content-center shadow bg-white">

<!--Reset Password-->
<div class="container p-5">
<h2 class="font-weight-bold mt-3">Reset Password</h2>
<hr>
<p>Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one.</p>
<form method="POST">
{% csrf_token %}
{{ password_reset_form|crispy }}
<button class="btn btn-primary" type="submit">Send email</button>
</form>
</div>

{% endblock %}
21 changes: 21 additions & 0 deletions auth_wiki/account/templates/account/password_reset_complete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends 'base.html' %}
{% block title %} Auth Wiki - Sign Up {% endblock %}


{% block content %}

<div class="col-12 col-lg-6">
<img class="main-img" src="https://wallpapercave.com/dwp1x/wp26286.jpg" alt="">
</div>

<div class="col-12 col-lg-6 main-form" style="padding: 100px 50px 100px 20px;">
<div class="border rounded p-4 w-80 d-flex justify-content-center shadow bg-white">
<!--Password Reset Complete-->
<div class="container p-4">
<h2 class="font-weight-bold mt-3">Password reset complete</h2>
<hr>
<p>Your password has been set. You may go ahead and log in now.</p>
<a href="{% url 'account:login' %}" class="btn btn-primary">Log in</a>
</div>
</div>
{% endblock %}
28 changes: 28 additions & 0 deletions auth_wiki/account/templates/account/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends 'base.html' %}
{% block title %} Auth Wiki - Sign Up {% endblock %}


{% block content %}
{% load crispy_forms_tags %}

<div class="col-12 col-lg-6">
<img class="main-img" src="https://wallpapercave.com/dwp1x/wp26286.jpg" alt="">
</div>

<div class="col-12 col-lg-6 main-form" style="padding: 100px 50px 100px 20px;">
<div class="border rounded p-4 w-80 d-flex justify-content-center shadow bg-white">

<!--Password Reset Confirm-->
<div class="container p-5">
<h2 class="font-weight-bold mt-3">Password Reset Confirm</h2>
<hr>
<p>Please enter your new password.</p>
<form method="POST">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" type="submit">Reset password</button>
</form>
</div>
</div>

{% endblock %}
22 changes: 22 additions & 0 deletions auth_wiki/account/templates/account/password_reset_done.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends 'base.html' %}
{% block title %} Auth Wiki - Sign Up {% endblock %}


{% block content %}

<div class="col-12 col-lg-6">
<img class="main-img" src="https://wallpapercave.com/dwp1x/wp26286.jpg" alt="">
</div>

<div class="col-12 col-lg-6 main-form" style="padding: 100px 50px 100px 20px;">
<div class="border rounded p-4 w-80 d-flex justify-content-center shadow bg-white">

<!--Password reset sent-->
<div class="container p-5">
<h2 class="font-weight-bold mt-3">Password reset sent</h2>
<hr>
<p>We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.<br>If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder.</p>
</div>
</div>

{% endblock %}
15 changes: 15 additions & 0 deletions auth_wiki/account/templates/account/password_reset_email.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% autoescape off %}
Hello,

We received a request to reset the password for your account for this email address. To initiate the password reset process for your account, click the link below.

{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}

This link can only be used once. If you need to reset your password again, please visit {{ protocol }}://{{domain}} and request another reset.

If you did not make this request, you can simply ignore this email.

Sincerely,
The Zuri Auth_Wiki team

{% endautoescape %}
36 changes: 30 additions & 6 deletions auth_wiki/account/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<nav class="navbar navbar-expand-lg un-nav py-3">
<div class="container-fluid">
<div class="nav-logo pl-5">
<a class="navbar-brand" href="{% url 'home' %}"
<a class="navbar-brand" href="{% url 'account:home' %}"
><span><img src="{% static 'main/img/head.png'%}" alt="logo-head" /></span>
<span class="logo-text">AUTH-WIKI</span></a
>
Expand All @@ -36,25 +36,49 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0 ms-lg-auto">
<li class="nav-item active text-style">
<a class="nav-link" href="{% url 'about' %}">ABOUT</a>
<a class="nav-link" href="{% url 'library:about' %}">ABOUT</a>
</li>
<li class="nav-item text-style">
<a class="nav-link" href="{% url 'faq' %}">FAQS</a>
<a class="nav-link" href="{% url 'library:faq' %}">FAQS</a>
</li>
<li class="nav-item text-style">
<a class="nav-link" href="#">DOCUMENTATION</a>
<a class="nav-link" href="{% url 'library' %}">DOCUMENTATION</a>
</li>
</ul>


{% comment %} <a class="nav-link mx-2" href="{% url 'account:logout' %}">Logout</a>
<a class="nav-link mx-2" href="{% url 'account:profile' %}">{{user.username}}'s Profile</a>
{% else %}
<a class="nav-link mx-2" href="{% url 'account:login' %}">Login</a>
<a class="nav-link mx-2" href="{% url 'account:register' %}">Register</a>
{% endif %} {% endcomment %}




{% if user.is_authenticated %}

<div class="d-flex">
<div class="me-4">
<a href="{% url 'account:login' %}" class="btn btn-outline-warning un-link">
Sign In
<a href="{% url 'account:logout' %}" class="btn btn-outline-warning un-link">
Log Out
</a>
</div>
<div class="me-4">
<a href="{% url 'account:profile' %}" class="btn btn-outline-warning un-link">
{{user.username}}'s Profile
</a>
</div>
{% else %}

<div>
<a href="{% url 'account:register' %}" class="btn un-link btn-warning">Sign Up</a>
</div>
<div>
<a href="{% url 'account:login' %}" class="btn un-link btn-warning">Log In</a>
</div>
{% endif %}

<!-- Auth users -->
<!-- <div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{% extends 'base.html' %}
{% block title %} Auth Wiki - Sign Up {% endblock %}
{% load widget_tweaks %}
{% block title %} Auth Wiki - Edit Profile {% endblock %}
<!--{% load widget_tweaks %}-->

{% block content %}


<div class="container-xl px-4 mt-4">
<!-- Account page navigation-->
<nav class="nav nav-borders">
Expand All @@ -15,18 +14,7 @@
<div class="col-xl-4">
<!-- Profile picture card-->
<div class="card mb-4 mb-xl-0">
{% comment %} <div class="card-header">Profile Picture</div>
<div class="card-body text-center">
<!-- Profile picture image-->
<img class="img-account-profile rounded-circle mb-2" src="http://bootdey.com/img/Content/avatar/avatar1.png" alt="">
<!-- Profile picture help block-->
<div class="small font-italic text-muted mb-4">JPG or PNG no larger than 5 MB</div>
<!-- Profile picture upload button-->
<div class="">
<label for="">Upload Profile Image</label>
<input class="py-2" placeholder="upload a clear profile image" type="file" accept="image/*" name="upload" id="upload">
</div> {% endcomment %}
{% comment %} <button class="btn btn-primary" type="button">Upload new image</button> {% endcomment %}

</div>
</div>
</div>
Expand Down Expand Up @@ -87,36 +75,22 @@
<label class="small mb-1" for="">Contact Number</label>
<input class="form-control" placeholder="08100000000" type="text" value= "" name="contact_number" id="contact_number">
</div>
{% comment %} <div class="mb-3">
<label class="small mb-1" for="inputEmailAddress">Email address</label>
<input class="form-control" id="inputEmailAddress" type="email" placeholder="Enter your email address" value="[email protected]">
</div>
<!-- Form Row-->
<div class="row gx-3 mb-3">
<!-- Form Group (phone number)-->
<div class="col-md-6">
<label class="small mb-1" for="inputPhone">Phone number</label>
<input class="form-control" id="inputPhone" type="tel" placeholder="Enter your phone number" value="555-123-4567">
</div>
<!-- Form Group (birthday)-->
<div class="col-md-6">
<label class="small mb-1" for="inputBirthday">Birthday</label>
<input class="form-control" id="inputBirthday" type="text" name="birthday" placeholder="Enter your birthday" value="06/10/1988">
</div>
</div> {% endcomment %}

<!-- Save changes button-->
<input class="btn btn-success" name="Add" value="Save Changes" type="submit">
{% comment %} <button class="btn btn-primary" type="button">Save changes</button> {% endcomment %}

</form>
</div>
</div>
</div>
</div>
</div>


<!----
<form class=" m-10" method="post" enctype="multipart/form-data" >
{% csrf_token %}

<div class="col-lg-8">
<div class="card mb-4">
<div class="card-body">
Expand All @@ -140,6 +114,7 @@
<option value="others">Others</option>
<option value="choose not to say">Choose not to say</option>
<--<option value="select gender" selected>Select Gender</option>--

</select>
<--<input class="" type="text" value= "first_name" name="first_name" id="first_name">--
</div>
Expand All @@ -154,4 +129,5 @@
</form>-->


{% endblock content %}
{% endblock content %}

17 changes: 17 additions & 0 deletions auth_wiki/account/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
{% load widget_tweaks %}

{% block content %}

{% if status == 'error' %}

<div class="alert alert-danger" role="alert">
{{ alert_msg }}
</div>

{% elif status == 'success' %}

<div class="alert alert-success" role="alert">
{{ alert_msg }}
</div>

{% endif %}

<div class="col-12 col-lg-6">
<img class="main-img" src="https://wallpapercave.com/dwp1x/wp26286.jpg" alt="">
</div>
Expand All @@ -26,6 +41,8 @@ <h2 class="text-center mb-4">Welcome Back</h2>
<div class="d-grid gap-3">
<button class="btn btn-primary d-block" type="submit">Log In</button>
<p class="text-center">Don't have an account? <a href="{% url 'account:register' %}">Create an account</a></p>
<p class="text-center">Forget your Password? <a href="{% url 'account:password_reset' %}">Reset it Here</a>.</p>

</div>
<!-- <div class="d-flex justify-content-between align-items-center mb-3">
<span class="line"></span>
Expand Down
Loading