Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add on_validation options for validation something like captcha #86

Closed
wants to merge 1 commit into from

Conversation

Freeza91
Copy link

show an example

omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :identity,  on_validation: lambda {|env| Captcha.valid_captcha?(env)}
end

Captcha.rb

class Captcha

  def self.valid_captcha?(env)
    env = env[:env]
    session = env["rack.session"]
    params = env["rack.request.form_hash"]

    # unless params['captcha'] == session['captcha']
    #   env["omniauth.identity"].errors.add(:base, 'valid captcha')
    #   return false
    # end

    true
  end
end

@Freeza91 Freeza91 changed the title add on_validate options for something like captcha add on_validate options for validate something like captcha Mar 17, 2016
@Freeza91 Freeza91 changed the title add on_validate options for validate something like captcha add on_validate options for validation something like captcha Mar 18, 2016
@Freeza91 Freeza91 changed the title add on_validate options for validation something like captcha add on_validation options for validation something like captcha Mar 18, 2016
pboling added a commit that referenced this pull request Feb 14, 2021
@pboling
Copy link
Member

pboling commented Feb 14, 2021

Closed by #103

Thanks @Freeza91

@pboling pboling closed this Feb 14, 2021
TrueSoft added a commit to TrueSoft/omniauth-identity that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants