Sha256: e4e7334f8d9425c206f892f6285b5c4f371c5da262f16f170e4d04e75407da72
Contents?: true
Size: 943 Bytes
Versions: 7
Compression:
Stored size: 943 Bytes
Contents
module DeviseTokenAuth class ConfirmationsController < Devise::ConfirmationsController include Devise::Controllers::Helpers def show @user = User.confirm_by_token(params[:confirmation_token]) if @user # create client 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 def generate_url(url, params = {}) uri = URI(url) uri.query = params.to_query uri.to_s end end end
Version data entries
7 entries across 7 versions & 1 rubygems