Skip to content

Commit

Permalink
Merge pull request #95 from gcivil-nyu-org/signup_button
Browse files Browse the repository at this point in the history
signup on Login
  • Loading branch information
revindsilva26 committed Nov 7, 2023
2 parents 10bcaa8 + 93f9ee5 commit 4d3bffd
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
18 changes: 18 additions & 0 deletions accounts/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@
background-color: #1e87d0; /* Darker background color on button press */
}

.signup-text {
text-align: left;
margin-top: 20px;
font-size: 16px;
}

.signup-link {
color: #3498db;
text-decoration: none;
}

.signup-link:hover {
text-decoration: underline;
}

</style>


Expand All @@ -72,6 +87,9 @@ <h2 class="title">Log In</h2>
{{ form.as_p }}
<button type="submit" class="btn btn-primary" id="login-button">Login</button>
</form>
<div class="signup-text">
Are you new to CheerUp? <a href="{% url 'signup' %}" class="signup-link">Sign up now</a>
</div>
</div>


Expand Down
25 changes: 23 additions & 2 deletions accounts/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# from django.test import TestCase
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User

# Create your tests here.

class LoginViewTestCase(TestCase):
def setUp(self):
# Create a user for testing login
self.username = "testuser"
self.password = "securepassword123"
User.objects.create_user(
self.username, email="test@example.com", password=self.password
)

def test_login_page_renders(self):
# Test if login page renders correctly
response = self.client.get(reverse("login"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "registration/login.html")

def test_form_displayed(self):
# Test if the login form is in the context
response = self.client.get(reverse("login"))
self.assertIn("form", response.context)

0 comments on commit 4d3bffd

Please sign in to comment.