mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Ensure that all API calls and static resources are in their own unique paths. This makes it easier to add a load balancer on top of everything.
This commit is contained in:
parent
7da3c91289
commit
1d77d8c97d
34 changed files with 37 additions and 36 deletions
11
res/auth/ldap/scripts/app.js
Normal file
11
res/auth/ldap/scripts/app.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
define([
|
||||
'angular'
|
||||
, './controllers/index'
|
||||
]
|
||||
, function(ng) {
|
||||
return ng.module('app', [
|
||||
'ngRoute'
|
||||
, 'app.controllers'
|
||||
])
|
||||
}
|
||||
)
|
11
res/auth/ldap/scripts/bootstrap.js
vendored
Normal file
11
res/auth/ldap/scripts/bootstrap.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
define([
|
||||
'require'
|
||||
, 'angular'
|
||||
, 'angular-route'
|
||||
, 'app'
|
||||
, 'routes'
|
||||
]
|
||||
, function(require, ng) {
|
||||
ng.bootstrap(document, ['app'])
|
||||
}
|
||||
)
|
37
res/auth/ldap/scripts/controllers/SignInCtrl.js
Normal file
37
res/auth/ldap/scripts/controllers/SignInCtrl.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
define(['./module'], function(mod) {
|
||||
mod.controller('SignInCtrl', ['$scope', '$http', function($scope, $http) {
|
||||
$scope.error = null
|
||||
|
||||
$scope.submit = function() {
|
||||
var data = {
|
||||
username: $scope.signin.username.$modelValue
|
||||
, password: $scope.signin.password.$modelValue
|
||||
}
|
||||
$scope.invalid = false
|
||||
$http.post('/api/v1/auth/ldap', data)
|
||||
.success(function(response) {
|
||||
$scope.error = null
|
||||
location.replace(response.redirect)
|
||||
})
|
||||
.error(function(response) {
|
||||
switch (response.error) {
|
||||
case 'ValidationError':
|
||||
$scope.error = {
|
||||
$invalid: true
|
||||
}
|
||||
break
|
||||
case 'InvalidCredentialsError':
|
||||
$scope.error = {
|
||||
$incorrect: true
|
||||
}
|
||||
break
|
||||
default:
|
||||
$scope.error = {
|
||||
$server: true
|
||||
}
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
}])
|
||||
})
|
6
res/auth/ldap/scripts/controllers/index.js
Normal file
6
res/auth/ldap/scripts/controllers/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
define([
|
||||
'./SignInCtrl'
|
||||
]
|
||||
, function() {
|
||||
}
|
||||
)
|
3
res/auth/ldap/scripts/controllers/module.js
Normal file
3
res/auth/ldap/scripts/controllers/module.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
define(['angular'], function(ng) {
|
||||
return ng.module('app.controllers', [])
|
||||
})
|
5
res/auth/ldap/scripts/entry.js
Normal file
5
res/auth/ldap/scripts/entry.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
require.ensure(['angular', 'angular-route'], function (require) {
|
||||
require('angular')
|
||||
require('angular-route')
|
||||
|
||||
})
|
19
res/auth/ldap/scripts/main.js
Normal file
19
res/auth/ldap/scripts/main.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
require.config({
|
||||
paths: {
|
||||
'angular': '../../../bower_components/angular/angular'
|
||||
, 'angular-route': '../../../bower_components/angular-route/angular-route'
|
||||
}
|
||||
, shim: {
|
||||
'angular': {
|
||||
exports: 'angular'
|
||||
}
|
||||
, 'angular-route': {
|
||||
deps: [
|
||||
'angular'
|
||||
]
|
||||
}
|
||||
}
|
||||
, deps: [
|
||||
'./bootstrap'
|
||||
]
|
||||
})
|
17
res/auth/ldap/scripts/routes.js
Normal file
17
res/auth/ldap/scripts/routes.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
define(['./app'], function(app) {
|
||||
return app.config([
|
||||
'$routeProvider'
|
||||
, '$locationProvider'
|
||||
, function($routeProvider, $locationProvider) {
|
||||
$locationProvider.html5Mode(true)
|
||||
$routeProvider
|
||||
.when('/', {
|
||||
templateUrl: 'partials/signin'
|
||||
, controller: 'SignInCtrl'
|
||||
})
|
||||
.otherwise({
|
||||
redirectTo: '/'
|
||||
})
|
||||
}
|
||||
])
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue