class window.SiteAuthController extends BaseCtrl
  constructor: (@$scope, @$rootScope, @$http, @$state, @$injector, @ContestBoards, @Dock, @Analytics, @Constants, @MixPanel) ->
    super(@$scope, @$rootScope, @$http, @$state, @$injector, @ContestBoards, @Dock, @Analytics, @Constants, @MixPanel)
    @sitePassword = ''
    @incorrectPassword || = false

  continue: ->
    @$http
      url: "#{apiPrefix}/v2/site/auth.json",
      method: 'POST',
      data: $.param({ password: @sitePassword })
      headers: { 'Content-Type': 'application/x-www-form-urlencoded'}
    .success (data) =>
      @$rootScope.sitePasswordToken = data.site_password_token
      @$state.go @Constants.routes.home
    .error (data) =>
      console.log data
      @incorrectPassword = true

SiteAuthController.$inject = ["$scope", "$rootScope", "$http", "$state", "$injector", "ContestBoards", "Dock", "Analytics", "Constants", "MixPanel"]

angular.module("shuttlerockApp").controller("SiteAuthController", SiteAuthController)