mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-27 19:25:13 +02:00
* Upgrading STF for security reasons Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update semaphore files Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * upgrading STF for security reasons v2 Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update yarn.lock file Signed-off-by: Denis barbaron <denis.barbaron@orange.com> --------- Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright © 2019-2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
|
**/
|
|
|
|
module.exports = function SignInCtrl($window, $scope, $http, CommonService) {
|
|
|
|
$window.angular.version = {}
|
|
|
|
$scope.error = null
|
|
|
|
$scope.submit = function() {
|
|
var data = {
|
|
name: $scope.signin.username.$modelValue
|
|
, email: $scope.signin.email.$modelValue
|
|
}
|
|
$scope.invalid = false
|
|
$http.post('/auth/api/v1/mock', data)
|
|
.then(function(response) {
|
|
$scope.error = null
|
|
location.replace(response.data.redirect)
|
|
})
|
|
.catch(function(response) {
|
|
switch (response.data.error) {
|
|
case 'ValidationError':
|
|
$scope.error = {
|
|
$invalid: true
|
|
}
|
|
break
|
|
case 'InvalidCredentialsError':
|
|
$scope.error = {
|
|
$incorrect: true
|
|
}
|
|
break
|
|
default:
|
|
$scope.error = {
|
|
$server: true
|
|
}
|
|
break
|
|
}
|
|
})
|
|
}
|
|
|
|
$scope.mailToSupport = function() {
|
|
CommonService.url('mailto:' + $scope.contactEmail)
|
|
}
|
|
|
|
$http.get('/auth/contact').then(function(response) {
|
|
$scope.contactEmail = response.data.contact.email
|
|
})
|
|
}
|