josephines1 / o-present

Sebuah aplikasi open source untuk kebutuhan presensi online berbasis website, dengan fitur GPS dan Foto Selfie.
MIT License
2 stars 0 forks source link

cant deploy #1

Open CLAR1US opened 1 month ago

CLAR1US commented 1 month ago

why i cant absent in ? its always say "lokasi anda tidak terdeteksi" but my browser not try to ask permission about location. how to make my browser make a permission about location so the app detect my location?

josephines1 commented 1 month ago

Hi CLAR1US, you can try changing the location access permissions in your browser by going to Settings > Privacy and security > Site settings > Permissions > Location. Make sure the URL of your deployed website is listed under "Allowed to see your location." This method works for Chrome browser.

CLAR1US commented 1 month ago

Hi josephines1! first, thank you for making this awesome project!

i just running this project in my local (xampp) and works perfectly! but when i deploy to my vm i found so many stress situation. even though I did the exact same thing as I did on local, the only difference was that I changed localhost to the IP address of my VM. This appears when I log in, so the login page appears but when I log in this error appears, I have tried troubleshooting for more than 3 hours but have not found a solution. Can you kindly help me about this?

image

josephines1 commented 1 month ago

You might try changing the folder name from "validation" to "Validation". You can find the myCustomValidation class in App\Libraries\validation\myCustomValidation.php. Maybe the error occurs because of sensitivity to capital letters in folder names.

Before change: App\Libraries\validation\myCustomValidation.php

After change: App\Libraries\Validation\myCustomValidation.php

Hope this helps :)

CLAR1US commented 4 weeks ago

Hai Josephines1 !

Thankyou for your help, its running !!! But there is a few trouble like :

  1. I cant open excel file when i Export it from Daily Absent, it say need repair.
  2. It is possible to create employee account without need email activation? if possible, how to make it?

btw once again thank you for making this awesome project! i need your paypal id to give a small donation, or if you indonesian just send me ur bank account number on my linkedin, i was send you a network request

josephines1 commented 4 weeks ago

Hello CLAR1US,

Regarding the first issue with the Excel file, you can click "Yes" in the dialog that appears, as shown in the screenshot below. Typically, the repair needed dialog only appears when the website is running on Localhost, but once it has been deployed to a hosting server, this dialog should not appear.

Screenshot 2024-06-07 175724

For the second issue concerning account activation, creating an employee account without activation is not possible. This is related to the password reset and email change mechanisms, which require the system to send a confirmation to a valid email (the email used to activate the account).

However, if you still want to add an employee account without requiring activation, you can manually add the employee data in the phpMyAdmin database (http://localhost/phpmyadmin). Here’s how:

This is the hash method for passwords used by Myth/Auth CodeIgniter:

password_hash(base64_encode(hash('sha384', "YOUR_PASSWORD", true)), PASSWORD_DEFAULT);

Replace "YOUR_PASSWORD" with the desired password string.

Additionally, regarding the network request on LinkedIn, could you please send me a message first? I have accepted all network requests on my LinkedIn. This is just to ensure I can identify your account. Thanks in advance!

CLAR1US commented 3 weeks ago

Hi,

I still can't open excel, even i choose "open and repair" I was trying using LibreOffice Ubuntu and Microsoft Office LTSC Proffesional PLus 2021 Version 2308 (Build 16731.20316)

Screenshot 2024-06-08 203805 Screenshot 2024-06-08 205203 Screenshot 2024-06-08 205312

Can you help me to fix this? Btw what version of Microsoft Office are you using?

*update

  1. it can be opened when I repair it using 3rd party ( https://products.aspose.app/cells/repair-excel )
  2. can be opened when I import into Google Spreadsheets

but still can't open directly with microsoft excel, or maybe just my microsoft excel? can you try to open this file?

O-Present_Laporan Presensi Harian_2024-06-07_2024-06-07.xlsx

josephines1 commented 3 weeks ago

Hi, sorry about the bug.

I just pushed an update to the repository to fix it. You can pull the latest from GitHub (with 'git pull') or re-download the files. If you want to update manually, check out the changes I made in the history below.

https://github.com/josephines1/o-present/commit/8e4b308755af69e5515fb522cc37f9181624378c

Basically, I added 'exit();' after each line with '$writer->save('php://output');'. I've tried it, and it works. (in Microsoft Excel 2021).

Hope this helps! Thanks for understanding earlier.

CLAR1US commented 3 weeks ago

OMG it works!

But i now i have problem with Mail System, you said : image

what am I doing right? i don't get it about "code you got from step 2 of the two-step verification" , should i turn on my 2nd authentication first? or just fill with my password?

image

image

josephines1 commented 3 weeks ago

Yes, you need to enable 2-step verification for the Google account you'll use to send emails. The code I'm referring to is the app password generated through Google's 2-step verification. To get it, you can follow Google's instructions at the link below.

https://support.google.com/accounts/answer/185833?hl=en

Hope this helps! 😊

CLAR1US commented 3 weeks ago

I found another bug,

  1. It show when i want to "reset password" from profile page Screenshot 2024-06-09 132158

  2. Head role can't approved/reject "sakit" and "izin" permission, only can "cuti" permission Screenshot 2024-06-09 133746

  3. When i want "forgot your password" (before login) then i fill token where i get from email, then when i submit it, it show like this Screenshot 2024-06-09 135152

josephines1 commented 3 weeks ago

Hi, sorry about the bug. For issues 1 and 3, I forgot to add these instructions in the Readme. Here are the steps to fix them:

  1. Open the file AuthController.php located in vendor\myth\auth\src\Controllers\AuthController.php

  2. Change the resendActivateAccount function to this:

    public function resendActivateAccount($login = false)
    {
        if ($this->config->requireActivation === null) {
            return redirect()->route('login');
        }
    
        $throttler = service('throttler');
    
        if ($login == false) {
            if ($throttler->check(md5($this->request->getIPAddress()), 2, MINUTE) === false) {
                return service('response')->setStatusCode(429)->setBody(lang('Auth.tooManyRequests', [$throttler->getTokentime()]));
            }
            $login = urldecode($this->request->getGet('login'));
        }
        $type  = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
    
        $users = model(UserModel::class);
    
        $user = $users->where($type, $login)
            ->where('active', 0)
            ->first();
    
        if (null === $user) {
            return redirect()->route('login')->with('error', lang('Auth.activationNoUser'));
        }
    
        $activator = service('activator');
        $sent      = $activator->send($user);
    
        if (!$sent) {
            return redirect()->back()->withInput()->with('error', $activator->error() ?? lang('Auth.unknownError'));
        }
    
        // Success!
        // return redirect()->route('login')->with('message', lang('Auth.activationSuccess'));
        return redirect()->to('/data-pegawai')->with('berhasil', 'Email aktivasi berhasil terkirim');
    }
  3. Then, also change the attemptForgot function to this:

    public function attemptForgot($email = false)
    {
        if ($this->config->activeResetter === null) {
            return redirect()->route('login')->with('error', lang('Auth.forgotDisabled'));
        }
    
        if (!$email) {
            $rules = [
                'email' => [
                    'label' => lang('Auth.emailAddress'),
                    'rules' => 'required|valid_email',
                ],
            ];
    
            if (!$this->validate($rules)) {
                dd($this->validator->getErrors());
                return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
            }
        }
    
        $users = model(UserModel::class);
    
        if ($email) {
            $user = $users->where('email', $email)->first();
        } else {
            $user = $users->where('email', $this->request->getPost('email'))->first();
        }
    
        if (null === $user) {
            return redirect()->back()->with('error', lang('Auth.forgotNoUser'));
        }
    
        // Save the reset hash /
        $user->generateResetHash();
        $users->save($user);
    
        $resetter = service('resetter');
        $sent     = $resetter->send($user);
    
        if (!$sent) {
            return redirect()->back()->withInput()->with('error', $resetter->error() ?? lang('Auth.unknownError'));
        }
    
        return redirect()->route('reset-password')->with('message', lang('Auth.forgotEmailSent'));
    }

Now, for issue 2, the Head role can't change the 'ketidakhadiran' status because the requested date is today (June 9, 2024). I set the permissions to only allow updating the absence status for dates after today. So, any absences submitted for today or previous dates can't be updated.

But if you want to allow changes for absences starting today, you can modify it like this:

  1. Open the kelola-pengajuan.php file located in app\Views\ketidakhadiran\kelola-pengajuan.php. At line 153, you'll find this code:
    <?php if ($data->tanggal_mulai <= date('Y-m-d')) : ?>

Change it to:

<?php if ($data->tanggal_mulai < date('Y-m-d')) : ?>
  1. Next, open the Ketidakhadiran.php file located in app\Controllers\Ketidakhadiran.php. At line 695, you'll find this code:
if ($data_ketidakhadiran->tanggal_mulai <= date('Y-m-d')) {

Change it to:

if ($data_ketidakhadiran->tanggal_mulai < date('Y-m-d')) {

This way, you can update the status for absences starting today.

Thanks for your feedback! Let me know if you have any other issues with the app.