Fix clock CAPTCHA on iOS

pull/38/head
Omar Roth 7 years ago
parent e1ab2d5e1d
commit 5800376818

@ -997,8 +997,8 @@ def generate_captcha(key)
challenge = "" challenge = ""
convert = Process.run(%(convert -density 1200 -resize 400x400 -background none svg:- png:-), shell: true, input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe) do |proc| convert = Process.run(%(convert -density 1200 -resize 400x400 -background none svg:- png:-), shell: true, input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe) do |proc|
challenge = proc.output.gets_to_end challenge = proc.output.gets_to_end
challenge = Base64.encode(challenge) challenge = Base64.strict_encode(challenge)
challenge = "data:image/png; base64, #{challenge}" challenge = "data:image/png;base64,#{challenge}"
end end
answer = "#{hour}:#{minute.to_s.rjust(2, '0')}" answer = "#{hour}:#{minute.to_s.rjust(2, '0')}"

@ -41,7 +41,7 @@
<label for="password">Password</label> <label for="password">Password</label>
<input required class="pure-input-1" name="password" type="password" placeholder="Password"> <input required class="pure-input-1" name="password" type="password" placeholder="Password">
<img src='<%= captcha.not_nil![:challenge] %>'/> <img style="width:100%" src='<%= captcha.not_nil![:challenge] %>'/>
<input type="hidden" name="token" value="<%= captcha.not_nil![:token] %>"> <input type="hidden" name="token" value="<%= captcha.not_nil![:token] %>">
<label for="challenge_response">Time (hh:mm):</label> <label for="challenge_response">Time (hh:mm):</label>
<input required type="text" name="challenge_response" type="text>" placeholder="hh:mm"> <input required type="text" name="challenge_response" type="text>" placeholder="hh:mm">

Loading…
Cancel
Save