Skip to content

Commit

Permalink
Merge pull request #5 from hyun-jung-joo/feature/account
Browse files Browse the repository at this point in the history
[fix] accounts structure
  • Loading branch information
hyun-jung-joo authored Jul 12, 2023
2 parents f07f8b5 + 5b9d4cc commit c54e14d
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 5 deletions.
Binary file not shown.
Binary file added prProject/accounts/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file added prProject/accounts/__pycache__/apps.cpython-39.pyc
Binary file not shown.
Binary file added prProject/accounts/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file added prProject/accounts/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 5 additions & 3 deletions prProject/accounts/templates/login.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load socialaccount %}
<!-- 소셜 로그인 구현되면 이거 풀고 해주세용-->
<!-- {#% load socialaccount %#} -->
<!DOCTYPE html>
<html lang="en">

Expand All @@ -21,9 +22,10 @@ <h1>로그인</h1>
</div>
<hr>
<input type="submit" value="로그인">

<!-- social login (카카오도 추가하기) -->
<a href="{% provider_login_url 'google' %}">
<i>구글 로그인</i>
<!-- <a href="{#% provider_login_url 'google' %#}"> -->
<i>구글 로그인</i>
</a>
</form>
</body>
Expand Down
32 changes: 30 additions & 2 deletions prProject/accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.contrib import auth
from django.contrib.auth.models import User

# Create your views here.
def signup(request) :
if request.method == 'POST' :
if request.POST['password'] == request.POST['repeat'] :
new_user = User.objects.create_user(username=request.POST['username'], password=request.POST['password'])
auth.login(request, new_user)
print("회원가입 성공")
return redirect('home')
return render(request, 'signup.html')

def login(request) :
if request.method == 'POST' :
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(request, username=username, password=password)

if user is not None :
auth.login(request, user)
print("로그인 성공")
return redirect('home')
else :
return render(request, 'bad_login.html')
else :
return render(request, 'login.html')

def logout(request) :
auth.logout(request)
return redirect('home')
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified prProject/prProject/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified prProject/prProject/__pycache__/settings.cpython-39.pyc
Binary file not shown.
Binary file modified prProject/prProject/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file modified prProject/prProject/__pycache__/wsgi.cpython-39.pyc
Binary file not shown.

0 comments on commit c54e14d

Please sign in to comment.