-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter 11: Account activation #11
base: master
Are you sure you want to change the base?
Conversation
boummm
commented
Apr 12, 2019
ready |
9326864
to
0387595
Compare
@@ -0,0 +1,2 @@ | |||
// Place all the behaviors and hooks related to the matching controller here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k dùng thì xoá, để cmt cái này hơi nhiều
class AccountActivationsController < ApplicationController | ||
def edit | ||
user = User.find_by email: params[:email] | ||
if user && !user.activated? && user.authenticated?(:activation, params[:id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anh chưa chỉ chú cách dùng user&.method à ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ban đầu em chạy rubocop nó tự chỉnh cho rồi mà bh up lên lại về như cũ :<
|
||
def active user | ||
user.activate | ||
user.update_attributes activated: true, activated_at: Time.zone.now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sao vẫn dùng update_attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sử dụng Time.current nhé
nêu giúp anh sự khác biệt vs hiện tại nếu có
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
em pull lên không hiểu sao nó bị về như cũ :(((
Time.zone được khởi chạy bởi ActiveSupport::Railtie thông qua active_support.initialize_time_zone nên nếu t xóa active_support.initialize_time_zone đi thì sẽ bị hiển thị thành nil trong khi Time.current vẫn ổn
end | ||
|
||
def password_reset | ||
@greeting = t("hi") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xoá đc ()
def password_reset | ||
@greeting = t("hi") | ||
|
||
mail to: "[email protected]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
đưa vào settings