This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from crab85193/dev_crab
認証メール再送機能を追加
- Loading branch information
Showing
19 changed files
with
460 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm | ||
|
||
class PasswordForgotForm(PasswordResetForm): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
for field in self.fields.values(): | ||
field.widget.attrs['class'] = 'form-control form-control-user' | ||
|
||
self.fields['email'].widget.attrs['placeholder'] = 'Enter Email Address...' | ||
|
||
|
||
class SetNewPasswordForm(SetPasswordForm): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
for field in self.fields.values(): | ||
field.widget.attrs['class'] = 'form-control form-control-user' | ||
|
||
self.fields['new_password1'].widget.attrs['placeholder'] = 'Enter New password...' | ||
self.fields['new_password2'].widget.attrs['placeholder'] = 'Enter New password confirmation...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView | ||
from django.urls import reverse_lazy | ||
from ..forms.password_forgot import PasswordForgotForm, SetNewPasswordForm | ||
|
||
class PasswordForgotView(PasswordResetView): | ||
template_name = 'main_app/password_forgot/password_forgot.html' | ||
subject_template_name = 'main_app/mail_templates/password_reset/subject.txt' | ||
email_template_name = 'main_app/mail_templates/password_reset/message.txt' | ||
form_class = PasswordForgotForm | ||
success_url = reverse_lazy('main_app:password_forgot_done') | ||
|
||
|
||
class PasswordForgotDoneView(PasswordResetDoneView): | ||
template_name = 'main_app/password_forgot/password_forgot_done.html' | ||
|
||
|
||
class PasswordResetConfirmView(PasswordResetConfirmView): | ||
template_name = 'main_app/password_forgot/password_reset_confirm.html' | ||
form_class = SetNewPasswordForm | ||
success_url = reverse_lazy('main_app:password_reset_complete') | ||
|
||
class PasswordResetCompleteView(PasswordResetCompleteView): | ||
template_name = 'main_app/password_forgot/password_reset_complete.html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
templates/main_app/mail_templates/password_reset/message.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
こんにちは {{ user.username }} さん | ||
|
||
パスワードを再設定するためには、以下のリンクをクリックしてください。 | ||
|
||
{{ protocol}}://{{ domain }}{% url 'main_app:password_reset_confirm' uid token %} | ||
|
||
もしこのメールが誤って届いた場合や、アカウント登録を行っていない場合は、このメールを無視していただいて結構です。 | ||
|
||
ご質問やお困りごとがあれば、お気軽にご連絡ください。 | ||
|
||
[Tely] サポートチーム |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
【Tely】パスワードの再設定 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html lang="ja"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta content="width=device-width, initial-scale=1.0" name="viewport"> | ||
|
||
<title>{% block title %}{% endblock %} - Tely</title> | ||
<meta content="" name="description"> | ||
<meta content="" name="keywords"> | ||
|
||
<!-- Favicons --> | ||
<link href="{% static 'img/favicon.png' %}" rel="icon"> | ||
<link href="{% static 'img/apple-touch-icon.png' %}" rel="apple-touch-icon"> | ||
|
||
<!-- Google Fonts --> | ||
<link href="https://fonts.gstatic.com" rel="preconnect"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet"> | ||
|
||
<!-- Vendor CSS Files --> | ||
<link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet"> | ||
<link href="{% static 'vendor/bootstrap-icons/bootstrap-icons.css' %}" rel="stylesheet"> | ||
<link href="{% static 'vendor/boxicons/css/boxicons.min.css' %}" rel="stylesheet"> | ||
<link href="{% static 'vendor/quill/quill.snow.css' %}" rel="stylesheet"> | ||
<link href="{% static 'vendor/quill/quill.bubble.css' %}" rel="stylesheet"> | ||
<link href="{% static 'vendor/remixicon/remixicon.css' %}" rel="stylesheet"> | ||
<link href="{% static 'vendor/simple-datatables/style.css' %}" rel="stylesheet"> | ||
|
||
<!-- Template Main CSS File --> | ||
<link href="{% static 'css/style.css' %}" rel="stylesheet"> | ||
|
||
{% block head %}{% endblock %} | ||
|
||
<!-- ======================================================= | ||
* Template Name: NiceAdmin | ||
* Updated: Sep 18 2023 with Bootstrap v5.3.2 | ||
* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ | ||
* Author: BootstrapMade.com | ||
* License: https://bootstrapmade.com/license/ | ||
======================================================== --> | ||
</head> | ||
|
||
<body> | ||
|
||
<main> | ||
{% block main %}{% endblock %} | ||
</main><!-- End #main --> | ||
|
||
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a> | ||
|
||
<!-- Vendor JS Files --> | ||
<script src="{% static 'vendor/apexcharts/apexcharts.min.js' %}"></script> | ||
<script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script> | ||
<script src="{% static 'vendor/chart.js/chart.umd.js' %}"></script> | ||
<script src="{% static 'vendor/echarts/echarts.min.js' %}"></script> | ||
<script src="{% static 'vendor/quill/quill.min.js' %}"></script> | ||
<script src="{% static 'vendor/simple-datatables/simple-datatables.js' %}"></script> | ||
<script src="{% static 'vendor/tinymce/tinymce.min.js' %}"></script> | ||
<script src="{% static 'vendor/php-email-form/validate.js' %}"></script> | ||
|
||
<!-- Template Main JS File --> | ||
<script src="{% static 'js/main.js' %}"></script> | ||
|
||
{% block script %}{% endblock %} | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{% extends 'main_app/password_forgot/base.html' %} | ||
{% load static %} | ||
|
||
{% block title %} | ||
パスワード再設定 | ||
{% endblock%} | ||
|
||
{% block main %} | ||
<div class="container"> | ||
|
||
<section class="section password-forgot min-vh-100 d-flex flex-column align-items-center justify-content-center py-4"> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-lg-4 col-md-6 d-flex flex-column align-items-center justify-content-center"> | ||
|
||
<div class="d-flex justify-content-center py-4"> | ||
<a href="{% url 'main_app:login' %}" class="logo d-flex align-items-center w-auto"> | ||
<img src="{% static 'img/logo.png' %}" alt=""> | ||
<span class="d-none d-lg-block">Tely</span> | ||
</a> | ||
</div><!-- End Logo --> | ||
|
||
<div class="card mb-3"> | ||
|
||
<div class="card-body"> | ||
|
||
<div class="pt-4 pb-2"> | ||
<h5 class="card-title text-center pb-0 fs-4">パスワード再設定</h5> | ||
<p class="text-center small">アカウント登録時に使用したメールアドレスを入力してください</p> | ||
</div> | ||
|
||
<form class="row g-3 needs-validation" method="POST"> | ||
{% csrf_token %} | ||
{% for field in form %} | ||
<div class="col-12"> | ||
<label for="id_{{ field.name }}" class="form-label">{{ field.label }}</label> | ||
<div class="input-group has-validation"> | ||
{{ field }} | ||
</div> | ||
|
||
{% if field.errors %} | ||
<div class="alert alert-danger" role="alert"> | ||
{% for error in field.errors %} | ||
<p>{{ error }}</p> | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
</div> | ||
{% endfor %} | ||
<div class="col-12"> | ||
<button class="btn btn-primary w-100" type="submit">パスワード再設定メールを送信する</button> | ||
</div> | ||
<div class="col-12"> | ||
<p class="small mb-0"><a href="{% url 'main_app:login' %}">ログインページへ</a></p> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<div class="credits"> | ||
<!-- All the links in the footer should remain intact. --> | ||
<!-- You can delete the links only if you purchased the pro version. --> | ||
<!-- Licensing information: https://bootstrapmade.com/license/ --> | ||
<!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ --> | ||
Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</div> | ||
{% endblock %} |
Oops, something went wrong.