Sha256: f8305b62bef395c70b7609c2b5b585ff3ca1ac4782c892b713c7af01e5501671

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

Sprangular.controller 'SigninCtrl', (
  $scope,
  $location,
  Account,
  Flash,
  Status,
  $translate
) ->
  Status.setPageTitle('nav.login')

  $scope.signingUp = false
  $scope.askForEmail = false

  $scope.user = {}

  $scope.$watch ->
    Account.email
  , (newVal) ->
    $scope.user.email = newVal if newVal

  $scope.guestLogin = ->
    $scope.signingIn = true
    Account.guestLogin($scope.cart)
      .success (content) ->
        $scope.signingIn = false
        $scope.$emit('account.login', Account)
        $location.path(Status.requestedPath || "/")
        Status.requestedPath = null
      .error ->
        $scope.signingIn = false

  $scope.login = ->
    $scope.signingIn = true

    Account.login($scope.user)
      .success (content) ->
        $scope.signingIn = false
        $scope.$emit('account.login', Account)

        $location.path(Status.requestedPath || "/")
        Status.requestedPath = null

      .error ->
        $scope.signingIn = false

  $scope.cancelEmailAsking = ->
    $scope.askForEmail = false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprangular-0.1.0 app/assets/javascripts/sprangular/controllers/signin.coffee