Commit 42fcfd3a authored by o@immerda.ch's avatar o@immerda.ch
Browse files

show app pw as qr code

parent 0e15eed0
......@@ -74,7 +74,7 @@
font-family: monospace;
}
.recovery-token-qr {
.qr-field {
border: dashed gray 3px;
padding: 10px;
margin-top: 20px;
......@@ -83,7 +83,7 @@
width: 260px;
}
.recovery-token-qr table {
.qr-field table {
margin: 0 auto;
border-width: 0;
border-style: none;
......@@ -91,7 +91,7 @@
border-collapse: collapse;
}
.recovery-token-qr td {
.qr-field td {
border-left: solid 4px #000;
padding: 0;
margin: 0;
......@@ -99,8 +99,8 @@
height: 4px;
}
.recovery-token-qr td.black { border-color: #000; }
.recovery-token-qr td.white { border-color: #fff; }
.qr-field td.black { border-color: #000; }
.qr-field td.white { border-color: #fff; }
.userlist th { font-weight: bold }
.userlist tr:nth-child(even) {background: #ddd}
......
......@@ -5,6 +5,12 @@ class AppPasswordsController < ApplicationController
@passwords = res['names']
if session[:app_pw]
@app_pw = session[:app_pw]
begin
@qr = RQRCode::QRCode.new(@app_pw, :size => 10, :level => :h)
rescue => e
@qr = ''
puts "qr token generation failed #{e}"
end
session[:app_pw] = nil
end
rescue ApiBackend::ApiError
......
......@@ -4,6 +4,8 @@
<b> <%= t(:your_app_pw_is) %> </b>
<p>
<div class="app-password"><%= @app_pw %></div>
<b><%= t(:qr_code) %></b>
<div class="qr-field"><%= raw(@qr.as_html) %></div>
</p>
<% end %>
<p>
......
......@@ -12,7 +12,7 @@
<p>
<b><%= t(:qr_code) %></b>
<%= t(:qr_token_help) %>
<div class="recovery-token-qr"><%= raw(@qr.as_html) %></div>
<div class="qr-field"><%= raw(@qr.as_html) %></div>
</p>
<% else %>
......
......@@ -19,7 +19,7 @@
<p>
<b><%= t(:qr_code) %></b>
<%= t(:qr_token_help) %>
<div class="recovery-token-qr"><%= raw(@qr.as_html) %></div>
<div class="qr-field"><%= raw(@qr.as_html) %></div>
</p>
<br />
<% else %>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment