summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/u2f/error.js.coffee
blob: 1a2fc3e757f4183f28d297022781273ca6da7139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
class @U2FError
  constructor: (@errorCode) ->
    @httpsDisabled = (window.location.protocol isnt 'https:')
    console.error("U2F Error Code: #{@errorCode}")

  message: () =>
    switch
      when (@errorCode is u2f.ErrorCodes.BAD_REQUEST and @httpsDisabled)
        "U2F only works with HTTPS-enabled websites. Contact your administrator for more details."
      when @errorCode is u2f.ErrorCodes.DEVICE_INELIGIBLE
        "This device has already been registered with us."
      else
        "There was a problem communicating with your device."