Commit 44c4fe91 authored by gergely-ujvari's avatar gergely-ujvari

Merge pull request #1798 from hypothesis/rename-auth-account

Move h.auth -> h.account on frontend
parents 11466a79 5446c79c
...@@ -85,5 +85,5 @@ class AccountController ...@@ -85,5 +85,5 @@ class AccountController
angular.module('h.auth') angular.module('h.account')
.controller('AccountController', AccountController) .controller('AccountController', AccountController)
...@@ -22,16 +22,16 @@ class AuthAppController ...@@ -22,16 +22,16 @@ class AuthAppController
onlogin = -> onlogin = ->
$window.location.href = '/stream' $window.location.href = '/stream'
$scope.auth = {} $scope.account = {}
$scope.model = {} $scope.model = {}
$scope.auth.tab = $location.path().split('/')[1] $scope.account.tab = $location.path().split('/')[1]
$scope.$on 'auth', (event, err, data) -> $scope.$on 'auth', (event, err, data) ->
if data?.userid if data?.userid
$timeout onlogin, 1000 $timeout onlogin, 1000
$scope.$watch 'auth.tab', (tab, old) -> $scope.$watch 'account.tab', (tab, old) ->
unless tab is old then $location.path("/#{tab}") unless tab is old then $location.path("/#{tab}")
# TODO: We should be calling identity.beginProvisioning() here in order to # TODO: We should be calling identity.beginProvisioning() here in order to
...@@ -126,6 +126,6 @@ configure = [ ...@@ -126,6 +126,6 @@ configure = [
] ]
angular.module('h.auth', imports, configure) angular.module('h.account', imports, configure)
.controller('AuthAppController', AuthAppController) .controller('AuthAppController', AuthAppController)
.controller('AuthPageController', AuthPageController) .controller('AuthPageController', AuthPageController)
...@@ -7,12 +7,12 @@ class AuthController ...@@ -7,12 +7,12 @@ class AuthController
if data.userid if data.userid
$scope.$emit 'auth', null, data $scope.$emit 'auth', null, data
$scope.auth.tab = $scope.account.tab =
switch $scope.auth.tab switch $scope.account.tab
when 'register' then 'login' when 'register' then 'login'
when 'forgot_password' then 'reset_password' when 'forgot_password' then 'reset_password'
when 'reset_password' then 'login' when 'reset_password' then 'login'
else $scope.auth.tab else $scope.account.tab
angular.copy {}, $scope.model angular.copy {}, $scope.model
$scope.form?.$setPristine() $scope.form?.$setPristine()
...@@ -30,7 +30,7 @@ class AuthController ...@@ -30,7 +30,7 @@ class AuthController
angular.bind(this, failure, form) angular.bind(this, failure, form)
.$promise.finally -> $scope.$broadcast 'formState', form.$name, '' .$promise.finally -> $scope.$broadcast 'formState', form.$name, ''
$scope.auth ?= tab: 'login' $scope.account ?= tab: 'login'
$scope.model ?= {} $scope.model ?= {}
$scope.$on 'auth', do -> $scope.$on 'auth', do ->
...@@ -53,5 +53,5 @@ class AuthController ...@@ -53,5 +53,5 @@ class AuthController
, 300000 , 300000
angular.module('h.auth') angular.module('h.account')
.controller('AuthController', AuthController) .controller('AuthController', AuthController)
...@@ -3,7 +3,7 @@ imports = [ ...@@ -3,7 +3,7 @@ imports = [
'ngRoute' 'ngRoute'
'ngSanitize' 'ngSanitize'
'ngTagsInput' 'ngTagsInput'
'h.auth' 'h.account'
'h.helpers' 'h.helpers'
'h.identity' 'h.identity'
'h.streamer' 'h.streamer'
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
tab-reveal="['forgot_password', 'reset_password']" tab-reveal="['forgot_password', 'reset_password']"
ng-controller="AuthController as vm" ng-controller="AuthController as vm"
ng-form="form" ng-form="form"
ng-model="auth.tab" ng-model="account.tab"
ng-submit="vm.submit(form[auth.tab])"> ng-submit="vm.submit(form[account.tab])">
<!-- Login --> <!-- Login -->
<form data-title="Sign in" <form data-title="Sign in"
data-value="login" data-value="login"
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<div class="form-actions"> <div class="form-actions">
<div class="form-actions-message"> <div class="form-actions-message">
<a href="" ng-click="auth.tab = 'forgot_password'" <a href="" ng-click="account.tab = 'forgot_password'"
>Forgot your password?</a> >Forgot your password?</a>
</div> </div>
<div class="form-actions-buttons"> <div class="form-actions-buttons">
......
...@@ -44,7 +44,7 @@ module.exports = function(config) { ...@@ -44,7 +44,7 @@ module.exports = function(config) {
'h/static/scripts/plugin/discovery.js', 'h/static/scripts/plugin/discovery.js',
'h/static/scripts/plugin/threading.js', 'h/static/scripts/plugin/threading.js',
'h/static/scripts/app.js', 'h/static/scripts/app.js',
'h/static/scripts/auth.js', 'h/static/scripts/account.js',
'h/static/scripts/helpers.js', 'h/static/scripts/helpers.js',
'h/static/scripts/session.js', 'h/static/scripts/session.js',
'h/static/scripts/hypothesis.js', 'h/static/scripts/hypothesis.js',
......
...@@ -2,7 +2,7 @@ assert = chai.assert ...@@ -2,7 +2,7 @@ assert = chai.assert
sinon.assert.expose assert, prefix: null sinon.assert.expose assert, prefix: null
sandbox = sinon.sandbox.create() sandbox = sinon.sandbox.create()
describe 'h.auth.AccountController', -> describe 'h.account.AccountController', ->
$scope = null $scope = null
fakeFlash = null fakeFlash = null
fakeSession = null fakeSession = null
...@@ -13,7 +13,7 @@ describe 'h.auth.AccountController', -> ...@@ -13,7 +13,7 @@ describe 'h.auth.AccountController', ->
profilePromise = null profilePromise = null
createController = null createController = null
beforeEach module('h.auth') beforeEach module('h.account')
beforeEach module ($provide, $filterProvider) -> beforeEach module ($provide, $filterProvider) ->
fakeSession = {} fakeSession = {}
......
...@@ -19,8 +19,8 @@ class MockSession ...@@ -19,8 +19,8 @@ class MockSession
mockFlash = sandbox.spy() mockFlash = sandbox.spy()
mockFormHelpers = applyValidationErrors: sandbox.spy() mockFormHelpers = applyValidationErrors: sandbox.spy()
describe 'h.auth', -> describe 'h.account', ->
beforeEach module('h.auth') beforeEach module('h.account')
beforeEach module('h.templates') beforeEach module('h.templates')
beforeEach module ($provide) -> beforeEach module ($provide) ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment