Skip to content

Commit

Permalink
Merge pull request #124 from HE-Arc/123-signup-register
Browse files Browse the repository at this point in the history
refactor signup by register
  • Loading branch information
Strogator authored Apr 14, 2024
2 parents c77f03b + 6dc2c21 commit cb39d59
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api/masteriqapp/views/AuthenticationView.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def logout(self, request):
return Response({'message': 'Logout successful'}, status=status.HTTP_200_OK)

@action(detail=False, methods=['POST'], permission_classes=[AllowAny])
def signup(self, request):
def register(self, request):
username = request.data.get('username')
password = request.data.get('password')
if not User.objects.filter(username=username).exists():
user = User.objects.create_user(username=username, password=password)
login(request, user)
return Response({'message': 'Signup successful'}, status=status.HTTP_201_CREATED)
return Response({'message': 'Register successful'}, status=status.HTTP_201_CREATED)
else:
return Response({'message': 'Username already exists'}, status=status.HTTP_400_BAD_REQUEST)
2 changes: 1 addition & 1 deletion frontend/src/api_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default
*/
static async registerUser(username, password) {
try {
const response = await axios.post('/api/user/signup/', {
const response = await axios.post('/api/user/register/', {
username,
password
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { RouterLink } from 'vue-router'
<RouterLink to="/add-question">Add question</RouterLink>
<RouterLink to="/login">Login</RouterLink>
<RouterLink to="/logout">Logout</RouterLink>
<RouterLink to="/signup">SignUp</RouterLink>
<RouterLink to="/register">Register</RouterLink>
</nav>
</div>
</header>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const router = createRouter({
component: () => import('../views/Authentication/LogoutView.vue')
},
{
path: '/signup',
name: 'Signup',
component: () => import('../views/Authentication/SignUpView.vue')
path: '/register',
name: 'Register',
component: () => import('../views/Authentication/RegisterView.vue')
}
]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const register = async () => {

<template>
<div>
<section class="signUp-form container">
<section class="Register-form container">
<div>
<h1 class="title">Register</h1>
<p class="info">Create a new account</p>
Expand Down

0 comments on commit cb39d59

Please sign in to comment.