Skip to content

Commit 501cb37

Browse files
committed
Merge branch 'dev'
2 parents 24d2ecb + 9bdf1f5 commit 501cb37

File tree

179 files changed

+9342
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+9342
-16
lines changed

.gitignore

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
/static
3-
/media
41
.idea
52
.idea/
63

@@ -15,10 +12,9 @@ __pycache__/
1512
local_settings.py
1613
db.sqlite3
1714
db.sqlite3-journal
18-
media
1915

2016
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
21-
# in your Git repository. Update and uncomment the following line accordingly.
17+
# in your Git repository. Update and uncont the following line accordingly.
2218
# <django-project-name>/staticfiles/
2319

2420
### Django.Python Stack ###
@@ -297,6 +293,9 @@ pyvenv.cfg
297293
.venv
298294
env/
299295
venv/
296+
myvenv/
297+
.myvenv
298+
myvenv.bak/
300299
ENV/
301300
env.bak/
302301
venv.bak/
2.95 MB
Binary file not shown.

accounts/__init__.py

Whitespace-only changes.

accounts/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

accounts/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class AccountsConfig(AppConfig):
5+
name = 'accounts'

accounts/forms.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
from django import forms
2+
from django.contrib.auth.forms import UserCreationForm, PasswordChangeForm
3+
from django.contrib.auth import get_user_model
4+
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
5+
from django.contrib.auth.models import User
6+
from django.forms import FileInput
7+
8+
from myprofile.models import Profile
9+
10+
11+
class CreateUserForm(UserCreationForm): # 내장 회원가입 폼을 상속받아서 확장한다.
12+
email = forms.EmailField(required=True) # 이메일 필드 추가
13+
last_name = forms.CharField(required=True, max_length=10)
14+
first_name = forms.CharField(required=True, max_length=10)
15+
16+
class Meta:
17+
model = User
18+
fields = ("username", "password1", "password2", "last_name", "first_name", "email")
19+
labels={"username":"아이디","last_name":"성","first_name":"이름","email":"이메일"}
20+
21+
def save(self, commit=True): # 저장하는 부분 오버라이딩
22+
user = super(CreateUserForm, self).save(commit=False) # 본인의 부모를 호출해서 저장하겠다.
23+
user.email = self.cleaned_data["email"]
24+
user.last_name = self.cleaned_data["last_name"]
25+
user.first_name = self.cleaned_data["first_name"]
26+
27+
if commit:
28+
user.save()
29+
return user
30+
31+
32+
class CustomUserChangeForm(UserChangeForm):
33+
class Meta:
34+
model = get_user_model() # settings.py에서 설정된 User 모델을 갖고옴
35+
fields = ['last_name', 'first_name', 'email']
36+
37+
def __init__(self, *args, **kwargs):
38+
super(UserChangeForm, self).__init__(*args, **kwargs)
39+
f = self.fields.get('user_permissions', None)
40+
self.fields.get('password').label = ''
41+
self.fields.get('password').help_text = ''
42+
if f is not None:
43+
f.queryset = f.queryset.select_related('content_type')
44+
45+
46+
class SignupModelForm(forms.ModelForm):
47+
class Meta:
48+
model = Profile
49+
fields = ('department', 'description', 'photo', 'interested_tag', 'naver', 'daum', 'github', 'other_url')
50+
widgets = {
51+
'photo': FileInput(),
52+
}
53+
54+
def __init__(self, *args, **kwargs):
55+
super(SignupModelForm, self).__init__(*args, **kwargs)
56+
self.fields['photo'].widget.attrs = {'id': 'selectedFile'}
57+
58+
59+
class password_changeForm(PasswordChangeForm): # 내장 회원가입 폼을 상속받아서 확장한다.
60+
class Meta:
61+
model = User
62+
fields = ("old_password","new_password1","new_password2")
63+
labels={"old_password":"기존 비밀번호","new_password1":"새 비밀번호","new_password2":"새 비밀번호 확인"}

accounts/migrations/__init__.py

Whitespace-only changes.

accounts/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

accounts/send.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from django.core.mail.message import EmailMessage
2+
3+
4+
def send_email():
5+
subject = "메시지"
6+
7+
from_email = '[email protected]'
8+
message = "메시지를 성공적으로 전송"
9+
EmailMessage(subject=subject, body=message, to=to, from_email=from_email).send()
10+
11+
def send_mail(subject, message, recipient_list=None):
12+
from django.conf import settings
13+
default_recipient_list = ['[email protected]']
14+
send_mail(
15+
subject=subject,
16+
message=message,
17+
from_email=settings.EMAIL_HOST_USER, #!
18+
recipient_list=recipient_list if recipient_list else default_recipient_list
19+
)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<style>
2+
* {
3+
font-family: 나눔스퀘어;
4+
text-decoration: none;
5+
margin: 0;
6+
padding: 0;
7+
}
8+
9+
.container {
10+
box-shadow: 2px 2px 2px #b0bec9;
11+
border: solid 1px #b0bec9;
12+
border-radius: 5px;
13+
margin: 80px auto;
14+
text-align: center;
15+
width: 400px;
16+
padding-top: 30px;
17+
padding-bottom: 30px;
18+
}
19+
20+
h1 {
21+
color: #1a237e;
22+
line-height: 60px;
23+
}
24+
25+
.start_logo {
26+
line-height: 60px;
27+
font-size: 25px;
28+
}
29+
30+
form {
31+
font-size: 20px;
32+
}
33+
34+
input {
35+
width: 300px;
36+
height: 40px;
37+
border-radius: 5px;
38+
border: solid 1px #b0bec9;
39+
margin-top: 20px;
40+
padding-left: 10px;
41+
}
42+
43+
a {
44+
color: #1a237e;
45+
font-weight: bold;
46+
}
47+
48+
#help {
49+
line-height: 50px;
50+
}
51+
52+
#error {
53+
font-size: 15px;
54+
margin: 0;
55+
padding: 0;
56+
}
57+
58+
footer > div {
59+
display: inline-block;
60+
font-size: 14px;
61+
margin: 10px;
62+
}
63+
64+
input[type=password] {
65+
font-family: "Adobe 고딕 Std B";
66+
}
67+
68+
input[type=submit] {
69+
background-color: #1E88E5;
70+
border: 1px solid #00B0F0;
71+
color: white;
72+
font-size: 15px;
73+
}
74+
75+
</style>
76+
{% extends "accounts/signupbase.html" %}
77+
78+
{% block content %}
79+
<div class="container">
80+
<div>
81+
<h1>LOG SHARE</h1>
82+
</div>
83+
<div class="start_logo">지금 로그쉐어를 시작하세요!</div>
84+
<form method="POST" action="{% url 'accounts:login' %}">
85+
{% csrf_token %}
86+
<div id="error">{{ error }}</div>
87+
<input name="username" type="text" placeholder="아이디">
88+
<input name="password" type="password" placeholder="비밀번호">
89+
<input type="submit" class="btn btn-primary" value="로그인">
90+
</form>
91+
<div id="help"><a href="{% url "accounts:password_reset" %}">암호를 잊으셨나요?</a></div>
92+
<div>로그쉐어는 처음이신가요? <a href="{% url "accounts:signup" %}">회원가입</a></div>
93+
</div>
94+
{% endblock %}
95+
</body>
96+
</html>

0 commit comments

Comments
 (0)