Completed
Push — master ( ae0d11...0ffb64 )
by IRFA
16s queued 12s
created
libraries/Auth.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  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 (empty($get)) {
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 		
28 28
 		if (password_verify($password, $get->password)) {
29 29
 			$user_datas = array(
30
-			        'user_id'  => $get->id,
31
-			        'logged_in' => TRUE,
32
-			        'login_token' => sha1($get->id.time().mt_rand(1000, 9999))
30
+					'user_id'  => $get->id,
31
+					'logged_in' => TRUE,
32
+					'login_token' => sha1($get->id.time().mt_rand(1000, 9999))
33 33
 			);
34 34
 			$this->CI->session->sess_regenerate();
35 35
 			$this->CI->session->set_userdata($user_datas);
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 	}
42 42
 	/**
43
-     * Cek sudah login apa belum.
44
-     *
45
-     * @return boolean
46
-     */
43
+	 * Cek sudah login apa belum.
44
+	 *
45
+	 * @return boolean
46
+	 */
47 47
 	public function check() {
48 48
 		if ($this->CI->session->logged_in) {
49 49
 			return true;
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	/**
56
-     * Cek hak akses.
57
-     *
58
-     * @return mixed
59
-     */
56
+	 * Cek hak akses.
57
+	 *
58
+	 * @return mixed
59
+	 */
60 60
 	public function hakAkses($hakAksesId) {
61 61
 		if ($this->user()->level != $hakAksesId) {
62 62
 			$this->CI->session->set_flashdata('warning', 'Anda tidak dapat mengakses halaman ini.');
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	/**
68
-     * Ambil data user sesuai dengan id yang login.
69
-     *
70
-     * @return mixed
71
-     */
68
+	 * Ambil data user sesuai dengan id yang login.
69
+	 *
70
+	 * @return mixed
71
+	 */
72 72
 	public function user() {
73 73
 		if ($this->check()) {
74 74
 			$get = $this->CI->user->getBy(['id' => $this->CI->session->user_id]);
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 
81 81
 	/**
82
-     * Keluar dari sesi.
83
-     *
84
-     * @return void
85
-     */
82
+	 * Keluar dari sesi.
83
+	 *
84
+	 * @return void
85
+	 */
86 86
 	public function logout() {
87 87
 		if (empty($this->CI->input->get('token'))) {
88 88
 			return redirect($_SERVER['HTTP_REFERER']);
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 		return redirect(base_url('login'));
102 102
 	}
103 103
 	/** 
104
-	* Mencegah guest untuk mengakses halaman
105
-	* @return void
106
-	*/
104
+	 * Mencegah guest untuk mengakses halaman
105
+	 * @return void
106
+	 */
107 107
 	public function protect($hakAksesId = null) {
108 108
 		if (!$this->check()) {
109 109
 			$this->destroy();
Please login to merge, or discard this patch.