Module: Mathcha::MathchaVerify

Defined in:
lib/mathcha/mathcha_verify.rb

Constant Summary collapse

SOLV_KEY =
0
SOLV =
1

Instance Method Summary collapse

Instance Method Details

#verify_mathcha(params) ⇒ Object

This method is used in conjunction with MatchaHelper#matcha_tag. Verifies the current session’s last generated mathcha. Returns true if we verify and false if otherwise.



9
10
11
12
13
# File 'lib/mathcha/mathcha_verify.rb', line 9

def verify_mathcha(params)
  if (solv_key = params[:solv_key]) and (solv = params[:solv])
    return (session[:solv] and session[:solv][SOLV_KEY] == solv_key.to_i and session[:solv][SOLV] == solv.to_i)
  end          
end