Skip to content

Conversation

nguyenthanhhaaa
Copy link

@nguyenthanhhaaa nguyenthanhhaaa commented Mar 24, 2025

WHAT (optional)

-Thêm chức năng đăng ký tài khoản, hiển thị lỗi khi đăng ký thất bại và thông báo khi đăng ký thành công.

HOW

-Tạo form đăng ký với các trường: tên, email, mật khẩu, xác nhận mật khẩu, giới tính.

-Kiểm tra tính hợp lệ của dữ liệu đầu vào (ví dụ: email đã tồn tại, mật khẩu quá ngắn, thiếu thông tin).

-Hiển thị lỗi khi người dùng nhập sai hoặc thiếu thông tin.

-Hiển thị thông báo chào mừng và thông tin tài khoản khi đăng ký thành công.

WHY (optional)

-Trước đây, ứng dụng chưa có tính năng đăng ký tài khoản.

-Cần bổ sung kiểm tra dữ liệu đầu vào để tránh sai sót khi người dùng nhập thông tin.

-Cải thiện trải nghiệm người dùng bằng cách hiển thị thông báo rõ ràng khi đăng ký thành công hoặc thất bại.

Evidence (Screenshot or Video)

-Hình ảnh form đăng ký thất bại với các lỗi hiển thị.
image

-Hình ảnh giao diện sau khi đăng ký thành công.
image

Notes (Kiến thức tìm hiểu thêm)

-Cách xử lý validation trong Rails (validates).

-Cách hiển thị lỗi khi nhập sai thông tin trong form.

-Cách sử dụng flash messages để hiển thị thông báo cho người dùng.

@nguyenthanhhaaa
Copy link
Author

ready

1 similar comment
@nguyenthanhhaaa
Copy link
Author

ready

@@ -41,6 +41,7 @@ gem "tzinfo-data", platforms: %i(mingw mswin x64_mingw jruby)

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
gem 'bcrypt', '3.1.18'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chú ý convention dùng nháy " hết cho file này nhé

Suggested change
gem 'bcrypt', '3.1.18'
gem "bcrypt", "3.1.18"

Comment on lines +78 to +79
gem 'sassc-rails'
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Đưa cái cụm này lên viết liền block trên cùng trước line 52 nè em

input {
height: auto !important;}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mấy cái lỗi end line nè, 1 line trống dưới cùng trong file, xóa hết space nếu có để nó hiểu line đó là line trống nha. Tìm hiều cách config visual studio code để nó tự động thêm end line cuối file, đỡ bị lỗi về sau nè

@@ -0,0 +1,29 @@
class UsersController < ApplicationController
def show

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thông thường 1 indent trong rails thì dùng 2 space cho 1 tab thôi e ơi, cái này có thể thiết lập trong vs code được đó e

@user = User.find_by id: params[:id]
return if @user

redirect_to root_path

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chỗ này trước khi redirect thì thêm flash message lỗi không tồn tại user nữa nhé

Suggested change
redirect_to root_path
flash[:error] = "Error ...."
redirect_to root_path

<a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
<%= link_to "Sign up now!", "#", class: "btn btn-primary btn-lg" %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n cho title của button/link các thứ e nhen

Comment on lines +11 to +12
</ul>
</div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

các thụt indent vào đang lộn xong nè em, ví dụ như bên dưới là sẽ thấy được phân cấp cha con nhen

Suggested change
</ul>
</div>
<div>
<ul>
</ul>
</div>

@@ -0,0 +1,55 @@
# MySQL. Versions 5.5.8 and up are supported.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Tạo 1 file mới từ file này, đặt tên là config/database.yml.example và xóa đi các nội dung value của username/password e nhé
  2. Đưa file config/database.yml vào gitignore để không đẩy lên github, lộ hết thông tin nhen

Comment on lines +2 to +4
get 'pages/home'
get 'pages/help'
get 'pages/contact'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dùng nháy " cho file này nhen

@@ -0,0 +1,4 @@
class AndGenderToUsers < ActiveRecord::Migration[7.0]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file này ko có nội dung change gì thì xóa e nhé

@thaodtd-0665
Copy link

commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants