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