-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
61 lines (56 loc) · 2.23 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
angular.module('DesafioFrontend', [])
.controller('DesafioFrontendController', function ($scope, $http) {
// Chamando a lista de usuários.
$http.get('http://localhost:8080/api/v1/user')
.then(function (response) {
$scope.users = response.data;
})
.catch(function (error) {
console.error('Erro na chamada da API:', error);
});
// Cadastrando um novo usuário.
$scope.formData = {};
$scope.submitForm = function () {
$http.post('http://localhost:8080/api/v1/user', $scope.formData)
.then(function (response) {
console.log('Resposta da API:', response.data);
})
.catch(function (error) {
console.error('Erro na chamada da API:', error);
});
};
// Retorna a classe de estilo para cada status da senha
$scope.getPasswordSecurityLevel = function (passwordSecurityLevel) {
switch (passwordSecurityLevel) {
case 'VERY_WEAK':
return 'user-password-security-level-very-weak';
case 'WEAK':
return 'user-password-security-level-weak';
case 'GOOD':
return 'user-password-security-level-good';
case 'STRONG':
return 'user-password-security-level-strong';
case 'VERY_STRONG':
return 'user-password-security-level-very-strong';
default:
return 'classe-padrao';
}
};
// Obtém a descricao do status da Senha
$scope.getPasswordSecurityLevelDescription = function (passwordSecurityLevel) {
switch (passwordSecurityLevel) {
case 'VERY_WEAK':
return 'Muito Fraca';
case 'WEAK':
return 'Fraca';
case 'GOOD':
return 'Boa';
case 'STRONG':
return 'Forte';
case 'VERY_STRONG':
return 'Muito Forte';
default:
return '';
}
};
});