Add UI to LDAP login.

This commit is contained in:
Simo Kinnunen
2014-01-31 21:39:07 +09:00
parent 01339b089e
commit 9119dcca63
15 changed files with 291 additions and 14 deletions

View 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', 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
}
})
}
}])
})

View File

@@ -0,0 +1,6 @@
define([
'./SignInCtrl'
]
, function() {
}
)

View File

@@ -0,0 +1,3 @@
define(['angular'], function(ng) {
return ng.module('app.controllers', [])
})