Passed
Push — master ( 3ee27e...b81719 )
by IRFA
01:07
created
libraries/Auth.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 		$this->CI = & get_instance();
14 14
 	}
15 15
 	/**
16
-     * Cek username dan password, jika password yang diinputkan sama dengan di database sama maka login sukses.
17
-     *
18
-     * @param string $username
19
-     * @param string $password
20
-     * @return boolean
21
-     */
16
+	 * Cek username dan password, jika password yang diinputkan sama dengan di database sama maka login sukses.
17
+	 *
18
+	 * @param string $username
19
+	 * @param string $password
20
+	 * @return boolean
21
+	 */
22 22
 	public function verify($username,$password){
23 23
 		$get = $this->CI->user->getBy(['username' => $username]);
24 24
 		if(password_verify($password, $get->password)) {
25 25
 			$user_datas = array(
26
-			        'user_id'  => $get->id,
27
-			        'logged_in' => TRUE,
28
-			        'login_token' => sha1($get->id.time().mt_rand(1000,9999))
26
+					'user_id'  => $get->id,
27
+					'logged_in' => TRUE,
28
+					'login_token' => sha1($get->id.time().mt_rand(1000,9999))
29 29
 			);
30 30
 			$this->CI->session->sess_regenerate();
31 31
 			$this->CI->session->set_userdata($user_datas);
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 		}
37 37
 	}
38 38
 	/**
39
-     * Cek sudah login apa belum.
40
-     *
41
-     * @return boolean
42
-     */
39
+	 * Cek sudah login apa belum.
40
+	 *
41
+	 * @return boolean
42
+	 */
43 43
 	public function check(){
44 44
 		if($this->CI->session->logged_in) {
45 45
 			return true;
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	/**
52
-     * Cek hak akses.
53
-     *
54
-     * @return mixed
55
-     */
52
+	 * Cek hak akses.
53
+	 *
54
+	 * @return mixed
55
+	 */
56 56
 	public function hakAkses($hakAksesId){
57 57
 		if($this->user()->level != $hakAksesId) {
58 58
 			$this->CI->session->set_flashdata('warning','Anda tidak dapat mengakses halaman ini.');
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 
63 63
 	/**
64
-     * Ambil data user sesuai dengan id yang login.
65
-     *
66
-     * @return mixed
67
-     */
64
+	 * Ambil data user sesuai dengan id yang login.
65
+	 *
66
+	 * @return mixed
67
+	 */
68 68
 	public function user(){
69 69
 		if($this->check()) {
70 70
 			$get = $this->CI->user->getBy(['id' => $this->CI->session->user_id]);
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	}
76 76
 
77 77
 	/**
78
-     * Keluar dari sesi.
79
-     *
80
-     * @return void
81
-     */
78
+	 * Keluar dari sesi.
79
+	 *
80
+	 * @return void
81
+	 */
82 82
 	public function logout(){
83 83
 		if(empty($this->CI->input->get('token'))){
84 84
 			return redirect($_SERVER['HTTP_REFERER']);
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 		return redirect(base_url('login'));
98 98
 	}
99 99
 	/** 
100
-	* Mencegah guest untuk mengakses halaman
101
-	* @return void
102
-	*/
100
+	 * Mencegah guest untuk mengakses halaman
101
+	 * @return void
102
+	 */
103 103
 	public function protect(){
104 104
 		if(!$this->check()){
105 105
 			$this->destroy();
Please login to merge, or discard this patch.