Browse Source

eliminr auth de prueba y editar UserSeeder para usar el num de empleado

parent
commit
51c168f966
2 changed files with 12 additions and 10 deletions
  1. 3
    3
      app/controllers/AuthController.php
  2. 9
    7
      app/database/seeds/UserTableSeeder.php

+ 3
- 3
app/controllers/AuthController.php View File

28
 
28
 
29
 		if (!$validator->fails()) {
29
 		if (!$validator->fails()) {
30
 			//			TODO: Remove this for production environment
30
 			//			TODO: Remove this for production environment
31
-			if (App::environment('local', 'staging')) {
32
-				return $this->processLogin();
33
-			}
31
+// 			if (App::environment('local', 'staging')) {
32
+// 				return $this->processLogin();
33
+// 			}
34
 			try {
34
 			try {
35
 				// User input
35
 				// User input
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));

+ 9
- 7
app/database/seeds/UserTableSeeder.php View File

42
                     $first_name = strtoupper(trim($data[1]));
42
                     $first_name = strtoupper(trim($data[1]));
43
                     $surnames = strtoupper(trim($data[2]));
43
                     $surnames = strtoupper(trim($data[2]));
44
                     $email = strtolower(trim($data[3]));
44
                     $email = strtolower(trim($data[3]));
45
-                    // $emp_number = strtolower(trim($data[5]));
45
+                    $emp_number = strtolower(trim($data[4]));
46
 
46
 
47
                     // Program unavailable.For the moment, I'm setting it to null, but it should eventually be the commented line below
47
                     // Program unavailable.For the moment, I'm setting it to null, but it should eventually be the commented line below
48
                     // $program_id = trim($data[4]);
48
                     // $program_id = trim($data[4]);
77
                                 'first_name' => $first_name,
77
                                 'first_name' => $first_name,
78
                                 'surnames' => $surnames,
78
                                 'surnames' => $surnames,
79
                                 'email' => $email,
79
                                 'email' => $email,
80
+                                'number' => $emp_number,
80
                                 // 'program_id' => $program_id, //should change when I know how this info will be given
81
                                 // 'program_id' => $program_id, //should change when I know how this info will be given
81
                                 'has_access' => 1,
82
                                 'has_access' => 1,
82
                                 'updated_at' => date("Y-m-d H:i:s", time()),
83
                                 'updated_at' => date("Y-m-d H:i:s", time()),
85
                         $this->command->info('Updated (via ssn): '.$email.': '.$surnames.', '.$first_name);
86
                         $this->command->info('Updated (via ssn): '.$email.': '.$surnames.', '.$first_name);
86
                         $updated++;
87
                         $updated++;
87
                     }
88
                     }
88
-
89
-                    // If user exists by name and last names, update information and add to updated
90
-                    elseif(User::where('first_name', $first_name)->where('surnames', $surnames)->count())
89
+                    // If user exists by employee number, update information and add to updated
90
+                    elseif(User::where('number', $emp_number)->count())
91
                     {
91
                     {
92
                         DB::table('users')
92
                         DB::table('users')
93
-                            ->where('first_name', ($first_name))
94
-                            ->where('surnames', ($surnames))
93
+                            ->where('number', ($emp_number))
95
                             ->update(array(
94
                             ->update(array(
96
                                 'ssn' => $ssn,
95
                                 'ssn' => $ssn,
97
                                 'email' => $email,
96
                                 'email' => $email,
97
+                                'first_name' => $first_name,
98
+                                'surnames' => $surnames,
98
                                 // 'program_id' => $program_id, //should change when I know how this info will be given
99
                                 // 'program_id' => $program_id, //should change when I know how this info will be given
99
                                 'has_access' => 1,
100
                                 'has_access' => 1,
100
                                 'updated_at' => date("Y-m-d H:i:s", time()),
101
                                 'updated_at' => date("Y-m-d H:i:s", time()),
112
                                 'ssn' => $ssn,
113
                                 'ssn' => $ssn,
113
                                 'first_name' => $first_name,
114
                                 'first_name' => $first_name,
114
                                 'surnames' => $surnames,
115
                                 'surnames' => $surnames,
116
+                                'number' => $emp_number,
115
                                 // 'program_id' => $program_id, //should change when I know how this info will be given
117
                                 // 'program_id' => $program_id, //should change when I know how this info will be given
116
                                 'has_access' => 1,
118
                                 'has_access' => 1,
117
                                 'updated_at' => date("Y-m-d H:i:s", time()),
119
                                 'updated_at' => date("Y-m-d H:i:s", time()),
120
                         $this->command->info('Updated (via email): '.$email.': '.$surnames.', '.$first_name);
122
                         $this->command->info('Updated (via email): '.$email.': '.$surnames.', '.$first_name);
121
                         $updated++;
123
                         $updated++;
122
                     }
124
                     }
123
-
124
                     // Otherwise, create user and add to added
125
                     // Otherwise, create user and add to added
125
                     else
126
                     else
126
                     {
127
                     {
130
                             'first_name' => $first_name,
131
                             'first_name' => $first_name,
131
                             'surnames' => $surnames,
132
                             'surnames' => $surnames,
132
                             'email' => $email,
133
                             'email' => $email,
134
+                            'number' => $emp_number,
133
                             'has_access' => 1,
135
                             'has_access' => 1,
134
                             'role' => 4,
136
                             'role' => 4,
135
                             // 'program_id' => $program_id, //should change when I know how this info will be given
137
                             // 'program_id' => $program_id, //should change when I know how this info will be given