PageSourceSearch

https://researchdata.edu.au/assets/profile/js/login.js

js researchdata.edu.au collected 2026-10-01 11:45:01 UTC 2,077 bytes, 70 lines download raw bytes

1var app = angular.module('app', ['ngRoute'], function($interpolateProvider){
2	$interpolateProvider.startSymbol('[[');
3	$interpolateProvider.endSymbol(']]');
4});
5
6app.config(['$routeProvider', function($routeProvider){
7	$routeProvider
8		.when('/', {
9			template:$('#main').html(),
10			controller:'mainController'
11		})
12		.when('/:method', {
13			template:$('#main').html(),
14			controller:'mainController'
15		})
16		.otherwise( {redirectTo:'/'})
17		;
18}]);
19
20
21app.directive('autoFillSync', function($timeout) {
22   return {
23      require: 'ngModel',
24      link: function(scope, elem, attrs, ngModel) {
25          var origVal = elem.val();
26          $timeout(function () {
27              var newVal = elem.val();
28              if(ngModel.$pristine && origVal !== newVal) {
29                  ngModel.$setViewValue(newVal);
30              }
31          }, 500);
32      }
33   }
34});
35
36app.controller('mainController', function($scope, $routeParams, loginService, $location){
37	$scope.tab = $routeParams.method ? $routeParams.method : $('#default_authenticator').val();
38	$scope.redirect = $location.search().redirect ? $location.search().redirect : base_url + 'profile';
39	$scope.error = $location.search().error ? $location.search().error : '';
40	$scope.message = $location.search().message ? $location.search().message : false;
41	
42	$scope.authenticate = function(method){
43		var data = {
44			username:$scope.username,
45			password:$scope.password
46		}
47		$('form button').button('loading');
48		$scope.message = false;
49		loginService.authenticate(method, data).then(function(data){
50			if(data.status=='ERROR'){
51				$scope.message = data.message;
52				$('form button').button('reset');
53			} else if(data.status=='SUCCESS'){
54				if(!$scope.redirect){
55					document.location.href = data.message.redirect_to;	
56				} else {
57					document.location.href = $scope.redirect;
58				}
59			}
60		});
61	}
62});
63
64app.factory('loginService', function($http){
65	return {
66		authenticate: function(method, data) {
67			return $http.post(registry_url+'auth/authenticate/'+method, data).then(function(response){return response.data});
68		}
69	}
70});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.