fix password reset emails based on svc_acct email address, fallout from #25533
[freeside.git] / ng_selfservice / process_login.php
1 <?
2
3 require('freeside.class.php');
4 $freeside = new FreesideSelfService();
5
6 $response = $freeside->login( array(
7   'email'    => strtolower($_POST['email']),
8   'username' => strtolower($_POST['username']),
9   'domain'   => strtolower($_POST['domain']),
10   'password' => $_POST['password'],
11 ) );
12
13 #error_log("[login] received response from freeside: $response");
14
15 $error = $response['error'];
16
17 if ( $error ) {
18
19   header('Location:index.php?username='. urlencode($username).
20                            '&domain='.   urlencode($domain).
21                            '&email='.    urlencode($email).
22                            '&error='.    urlencode($error)
23         );
24   die();
25
26 }
27
28 // sucessful login
29
30 $session_id = $response['session_id'];
31
32 error_log("[login] logged into freeside with session_id=$session_id, setting cookie");
33
34 // now what?  for now, always redirect to the main page.
35 // eventually, other options?
36
37 setcookie('session_id', $session_id);
38
39 header("Location:main.php")
40 #die();
41
42 ?>