readme.md in 2fa-0.0.1 vs readme.md in 2fa-0.0.2

- old
+ new

@@ -31,11 +31,11 @@ helpers.no_tfa do helpers.require_tfa(phone_number: '+15556667777', http_params: helpers.tfa_friendly_params(params), url: request.path) end helpers.if_tfa do - @example = example.new(example_params) + @example = Example.new(example_params) respond_to do |format| if @example.save format.html { redirect_to example_url(@example), notice: "example was successfully created." } format.json { render :show, status: :created, location: @example } @@ -47,17 +47,13 @@ end end ``` This is just a default scaffolded controller but with tfa auth. -This isn't perfect as in theory someone could pass a different unused tfa by inspecting the form, so to prevent this, you can take in a `|tfa|` argument from the helper to verify that the tfa has the correct phone number. +This isn't perfect as in theory someone could pass a different unused tfa by inspecting the form, so to prevent this, you can pass a `expected_phone: ` argument to `no_tfa` or `if_tfa` to add that requirement. ```rb -helpers.if_tfa do |tfa| - if tfa.phone == @user.phone - #...your code here - else - head 401 - end +helpers.if_tfa(expected_phone: @user.phone) do + #... end ``` ### Custom tfa check page To make a custom tfa check page, make the file `app/views/tfa/tfas/_show.html.erb`.