This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123ish LLC will provide a Social Network Service that navigates the users through the discovery of the best solutions, tools, places, people, products, and ideas for their specific interests and matters of living. | |
123ishは、ユーザーの特別な興味や生活の様々な場面において、最良な解決、手段、場所、人、商品、アイデアの発見を導くソーシャルネットワーキングサービスを提供します。 | |
123ish LLC akan menyediakan Layanan Jejaring Sosial yang menavigasi pengguna melalui penemuan solusi, alat, tempat, orang, produk, dan ide terbaik untuk kepentingan dan hal-hal khusus mereka. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test gist | |
# just a code chunk | |
require "securerandom" | |
require "active_support/dependencies/autoload" | |
.... | |
module ActiveSupport | |
extend ActiveSupport::Autoload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# /app/views/users/activate_2fa.html.erb %> | |
<%= @svg.html_safe %> | |
<%= form_for(@user, url: activate_2fa_update_path) do |f| %> | |
<%= f.text_field :otp_response_code %> | |
<%= f.submit %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'devise', '~> 4.7.1' | |
gem 'active_model_otp', '~> 2.0.1' | |
gem 'rqrcode', '~> 1.1.2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# /app/views/users/activate_2fa.html.erb %> | |
<%= @svg.html_safe %> | |
<%= form_for(@user, url: activate_2fa_update_path) do |f| %> | |
<%= f.text_field :otp_response_code %> | |
<%= f.submit %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'devise', '~> 4.7.1' | |
gem 'active_model_otp', '~> 2.0.1' | |
gem 'rqrcode', '~> 1.1.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/controllers/users/sessions_controller.rb | |
class Users::SessionsController < Devise::SessionsController | |
def create | |
self.resource = resource_class.find_for_authentication(sign_in_params.except(:password, :otp_response_code)) | |
if resource | |
if resource.active_for_authentication? | |
if resource && resource.otp_module_disabled? | |
continue_sign_in(resource, resource_name) | |
elsif resource && resource.otp_module_enabled? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# /app/views/users/sessions/two_factors_authentication.html.erb %> | |
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :role => 'form', :method => 'POST' }) do |f| %> | |
<%= f.hidden_field :email, value: params[:user][:email] %> | |
<%= f.text_field :otp_response_code %> | |
<%= f.submit %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/users_controller.rb | |
class UsersController < ApplicationController | |
def activate_2fa | |
qrcode = RQRCode::QRCode.new(current_user.provisioning_uri(nil, issuer: 'your-app-url.com'), :size => 12, :level => :h) | |
@svg = qrcode.as_svg(offset: 0, color: '000', | |
shape_rendering: 'crispEdges', | |
module_size: 4) | |
respond_to :html | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/models/entry.rb | |
class Entry < ApplicationRecord | |
extend FriendlyId | |
friendly_id :entry_slug_input, use: [:history, :finders, :slugged] | |
after_commit :set_slug_with_id, on: :create | |
def entry_slug_input | |
"#{id}-#{name}" | |
end |
OlderNewer