From 04f304db556301a37593a3d2609c92e11023593f Mon Sep 17 00:00:00 2001 From: aldenluthfi Date: Thu, 19 Sep 2024 15:34:53 +0700 Subject: [PATCH] rev: revised assignment questions --- assignments/individual/assignment-4.md | 9 ++++----- docs/tutorial-3.md | 1 - .../current/individual/assignment-4.md | 9 +++++---- .../docusaurus-plugin-content-docs/current/tutorial-3.md | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/assignments/individual/assignment-4.md b/assignments/individual/assignment-4.md index 7a83e0d..b987cf1 100644 --- a/assignments/individual/assignment-4.md +++ b/assignments/individual/assignment-4.md @@ -21,11 +21,10 @@ Pada tugas ini, kamu akan mengimplementasikan konsep *authentication*, *session* - [ ] Menghubungkan model `Product` dengan `User`. - [ ] Menampilkan detail informasi pengguna yang sedang *logged in* seperti *username* dan menerapkan `cookies` seperti `last login` pada halaman utama aplikasi. - [ ] Menjawab beberapa pertanyaan berikut pada `README.md` pada *root folder* (silakan modifikasi `README.md` yang telah kamu buat sebelumnya; tambahkan subjudul untuk setiap tugas). - - - [ ] Apa itu Django `UserCreationForm`, dan jelaskan apa kelebihan dan kekurangannya? - - [ ] Apa perbedaan antara autentikasi dan otorisasi dalam konteks Django, dan mengapa keduanya penting? - - [ ] Apa itu *cookies* dalam konteks aplikasi web, dan bagaimana Django menggunakan *cookies* untuk mengelola data sesi pengguna? - - [ ] Apakah penggunaan *cookies* aman secara *default* dalam pengembangan web, atau apakah ada risiko potensial yang harus diwaspadai? + - [ ] Apa perbedaan antara `HttpResponseRedirect()` dan `redirect()` + - [ ] Jelaskan cara kerja penghubungan model `MoodEntry` dengan `User`! + - [ ] Apa perbedaan antara *authentication* dan *authorization*, apakah yang dilakukan saat pengguna login? Jelaskan bagaimana Django mengimplementasikan kedua konsep tersebut. + - [ ] Bagaimana Django mengingat pengguna yang telah login? Jelaskan kegunaan lain dari *cookies* dan apakah semua cookies aman digunakan? - [ ] Jelaskan bagaimana cara kamu mengimplementasikan *checklist* di atas secara *step-by-step* (bukan hanya sekadar mengikuti tutorial). - [ ] Melakukan `add`-`commit`-`push` ke GitHub. diff --git a/docs/tutorial-3.md b/docs/tutorial-3.md index 2f82737..e1bf30b 100644 --- a/docs/tutorial-3.md +++ b/docs/tutorial-3.md @@ -255,7 +255,6 @@ Kita sudah menambahkan formulir registrasi akun dan membuat mekanisme `register` **Penjelasan Kode:** - - `authenticate(request, username=username, password=password)` digunakan untuk melakukan autentikasi pengguna berdasarkan username dan password yang diterima dari permintaan (_request_) yang dikirim oleh pengguna saat _login_. Jika kombinasi valid, maka objek `user` akan di-_return_. Jika tidak, maka akan mengembalikan `None`. - `login(request, user)` berfungsi untuk melakukan login terlebih dahulu. Jika pengguna valid, fungsi ini akan membuat _session_ untuk pengguna yang berhasil login. 3. Buatlah berkas HTML baru dengan nama `login.html` pada direktori `main/templates`. Isi dari `login.html` dapat kamu isi dengan _template_ berikut. diff --git a/i18n/en/docusaurus-plugin-content-docs-assignments/current/individual/assignment-4.md b/i18n/en/docusaurus-plugin-content-docs-assignments/current/individual/assignment-4.md index 723f2d3..98b48cc 100644 --- a/i18n/en/docusaurus-plugin-content-docs-assignments/current/individual/assignment-4.md +++ b/i18n/en/docusaurus-plugin-content-docs-assignments/current/individual/assignment-4.md @@ -22,11 +22,12 @@ Checklists for this assignment are: - [ ] Display *logged in* user details such as *username* and apply `cookies` like `last login` to the application's main page. - [ ] Answer the following questions in `README.md` in the root folder. (Modify your `README.md` that you have already created; add a subtitle for each assignment). - - [ ] What is a `UserCreationForm`, explain its advantages and disadvantages? - - [ ] What is the difference between authentication and authorization in Django, why are both important? - - [ ] What are *cookies* in web development, and how do Django use *cookies* to manage user sessions? - - [ ] Are the use of *cookies* safe by *default* in web development, or are there risks that needs to be noted? + - [ ] What is the difference between `HttpResponseRedirect()` and `redirect()`? + - [ ] Explain how the `MoodEntry` model is linked with `User`! + - [ ] What is the difference between *authentication* and *authorization*, and what happens when a user logs in? Explain how Django implements these two concepts. + - [ ] How does Django remember logged-in users? Explain other uses of *cookies* and whether all cookies are safe to use. - [ ] Explain how did you implement the checklist *step-by-step* (apart from following the tutorial). + - [ ] Perform `add`-`commit`-`push` to GitHub. ## Deadline diff --git a/i18n/en/docusaurus-plugin-content-docs/current/tutorial-3.md b/i18n/en/docusaurus-plugin-content-docs/current/tutorial-3.md index 3b00600..005005d 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/tutorial-3.md +++ b/i18n/en/docusaurus-plugin-content-docs/current/tutorial-3.md @@ -252,7 +252,6 @@ Now that we’ve added the registration form and created the `register` mechanis **Code Explanation:** - - `authenticate(request, username=username, password=password)` is used to authenticate the user based on the username and password received from the user's request when logging in. If the combination is valid, it returns a `user` object. Otherwise, it returns `None`. - `login(request, user)` is used to log in the user. If the user is valid, this function creates a session for the logged-in user. 3. Create a new HTML file named `login.html` in the `main/templates` directory. Fill it with the following template: