Sha256: 1f5bd6e819b7ede4c143343db2e6515c25db32ac010f3f6555a2c7073565d558
Contents?: true
Size: 758 Bytes
Versions: 131
Compression:
Stored size: 758 Bytes
Contents
class Account::TwoFactorsController < Account::ApplicationController before_action :authenticate_user! def verify @user = current_user otp_code = params["user"]["otp_attempt"] @verified = current_user.validate_and_consume_otp!(otp_code) if @verified current_user.update(otp_required_for_login: true) else current_user.update( otp_required_for_login: false, otp_secret: nil ) end end def create @backup_codes = current_user.generate_otp_backup_codes! @user = current_user current_user.update(otp_secret: User.generate_otp_secret) end def destroy @user = current_user current_user.update( otp_required_for_login: false, otp_secret: nil ) end end
Version data entries
131 entries across 131 versions & 1 rubygems