mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Rename the 'app' folder to 'res', because it can currently contain many apps.
This commit is contained in:
parent
5f8e617393
commit
50a9de1875
18 changed files with 2 additions and 2 deletions
37
res/auth/scripts/controllers/SignInCtrl.js
Normal file
37
res/auth/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 = {
|
||||
name: $scope.signin.name.$modelValue
|
||||
, email: $scope.signin.email.$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
|
||||
}
|
||||
})
|
||||
}
|
||||
}])
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue