-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbl.php
executable file
·57 lines (41 loc) · 1.26 KB
/
bl.php
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
<?php
class LoginService {
public function login($user, $pass) {
/*
Input: user (email) and pass
Output: Config array, with basic settings, user, ans token to be validated at each request:
[
'userName' string,
'userStd' int,
'companyCod' string,
'companyFullName',
'dtMin' = string format 'yyyy-MM-dd',
'dtMax' = string format 'yyyy-MM-dd',
'token' = string,
'accList = [
'acc = ['id',
'name',
'cod',
'active',
'obs'
[
]
*/
try {
$list = array();
// Test
$blo = new Bas();
$blo->test_pass($pass);
// Get
$usr = getUsrByUser($user);
if (!$usr) throw new Exception('invalid');
$dao = new LoginDao();
$data = $dao->login($user, $pass, $usr['dbid']);
$data[0]->token = $usr['token'];
return $data;
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}
}
?>