Sha256: 89b249722cfa9918ce604327d93d2aca1463881bd1ff70237e364dd974a3057b

Contents?: true

Size: 883 Bytes

Versions: 65

Compression:

Stored size: 883 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A form object used to fisnish signup from omniauth data
  class OmniauthRegistrationForm < Form
    mimic :user

    attribute :email, String
    attribute :name, String
    attribute :nickname, String
    attribute :provider, String
    attribute :uid, String
    attribute :tos_agreement, Boolean
    attribute :oauth_signature, String
    attribute :avatar_url, String
    attribute :raw_data, Hash

    validates :email, presence: true
    validates :name, presence: true
    validates :provider, presence: true
    validates :uid, presence: true

    def self.create_signature(provider, uid)
      Digest::MD5.hexdigest("#{provider}-#{uid}-#{Rails.application.secrets.secret_key_base}")
    end

    def normalized_nickname
      UserBaseEntity.nicknamize(nickname || name, organization: current_organization)
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.9 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.28.3 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.8 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.28.2 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.7 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.28.1 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.6 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.26.10 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.26.9 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.28.0 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.5 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.28.0.rc5 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.28.0.rc4 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.26.8 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.4 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.3 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.26.7 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.26.5 app/forms/decidim/omniauth_registration_form.rb
decidim-core-0.27.2 app/forms/decidim/omniauth_registration_form.rb