5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/devise_token_auth/confirmations_controller.rb', line 5
def show
@user = User.confirm_by_token(params[:confirmation_token])
if @user.id
client_id = SecureRandom.urlsafe_base64(nil, false)
token = SecureRandom.urlsafe_base64(nil, false)
token_hash = BCrypt::Password.create(token)
@user.tokens[client_id] = {
token: token_hash,
expiry: Time.now + 2.weeks
}
@user.save!
redirect_to generate_url(@user.confirm_success_url, {
token: token,
client_id: client_id,
uid: @user.uid
})
else
raise ActionController::RoutingError.new('Not Found')
end
end
|