Sha256: a14998cfabccafa291375e439779ae781ada59282f06f83309bd1a8d553b68ee
Contents?: true
Size: 747 Bytes
Versions: 11
Compression:
Stored size: 747 Bytes
Contents
module RegistrationTokenValidation extend ActiveSupport::Concern included do before_action :validate_registration_token! end def validate_registration_token! redirect_to new_user_session_path unless registration_token_valid? end def registration_token_valid? params[:registration_token].present? && registration_token_resolves? end def registration_token_resolves? encrypted_token = Devise.token_generator.digest( Jobshop::Team, :registration_token, params[:registration_token]) configurable = Jobshop::Team.find_by( id: params[:team_id], registration_token: encrypted_token) configurable && configurable.registration_token_period_valid? && configurable.owner.blank? end end
Version data entries
11 entries across 11 versions & 1 rubygems