fork(1) download
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Auth;
  4.  
  5. use App\Http\Controllers\Controller;
  6. use App\Models\AdminNotification;
  7. use App\Models\GeneralSetting;
  8. use App\Models\User;
  9. use App\Models\UserLogin;
  10. use Illuminate\Auth\Events\Registered;
  11. use Illuminate\Foundation\Auth\RegistersUsers;
  12. use Illuminate\Http\Request;
  13. use Illuminate\Support\Facades\Hash;
  14. use Illuminate\Support\Facades\Validator;
  15. use Illuminate\Validation\Rules\Password;
  16.  
  17. class RegisterController extends Controller
  18. {
  19. /*
  20.   |--------------------------------------------------------------------------
  21.   | Register Controller
  22.   |--------------------------------------------------------------------------
  23.   |
  24.   | This controller handles the registration of new users as well as their
  25.   | validation and creation. By default this controller uses a trait to
  26.   | provide this functionality without requiring any additional code.
  27.   |
  28.   */
  29.  
  30. use RegistersUsers;
  31.  
  32. /**
  33.   * Create a new controller instance.
  34.   *
  35.   * @return void
  36.   */
  37. public function __construct()
  38. {
  39. $this->middleware('guest');
  40. $this->middleware('regStatus')->except('registrationNotAllowed');
  41.  
  42. $this->activeTemplate = activeTemplate();
  43. }
  44.  
  45. public function referralRegister($reference)
  46. {
  47. $page_title = "Sign Up";
  48. session()->put('reference', $reference);
  49. $info = json_decode(json_encode(getIpInfo()), true);
  50. $mobile_code = @implode(',', $info['code']);
  51. $countries = json_decode(file_get_contents(resource_path('views/partials/country.json')));
  52. return view($this->activeTemplate . 'user.auth.register', compact('reference', 'page_title','mobile_code','countries'));
  53. }
  54.  
  55. public function showRegistrationForm()
  56. {
  57. $pageTitle = "Sign Up";
  58. $info = json_decode(json_encode(getIpInfo()), true);
  59. $mobile_code = @implode(',', $info['code']);
  60. $countries = json_decode(file_get_contents(resource_path('views/partials/country.json')));
  61. $reference = null;
  62. return view($this->activeTemplate . 'user.auth.register', compact('pageTitle','mobile_code','countries','reference'));
  63. }
  64.  
  65.  
  66. /**
  67.   * Get a validator for an incoming registration request.
  68.   *
  69.   * @param array $data
  70.   * @return \Illuminate\Contracts\Validation\Validator
  71.   */
  72. protected function validator(array $data)
  73. {
  74. $general = GeneralSetting::first();
  75. $password_validation = Password::min(6);
  76. if ($general->secure_password) {
  77. $password_validation = $password_validation->mixedCase()->numbers()->symbols()->uncompromised();
  78. }
  79. $agree = 'nullable';
  80. if ($general->agree) {
  81. $agree = 'required';
  82. }
  83. $countryData = (array)json_decode(file_get_contents(resource_path('views/partials/country.json')));
  84. $countryCodes = implode(',', array_keys($countryData));
  85. $mobileCodes = implode(',',array_column($countryData, 'dial_code'));
  86. $countries = implode(',',array_column($countryData, 'country'));
  87. $validate = Validator::make($data, [
  88. 'firstname' => 'sometimes|required|string|max:50',
  89. 'lastname' => 'sometimes|required|string|max:50',
  90. 'email' => 'required|string|email|max:90|unique:users',
  91. 'mobile' => 'required|string|max:50|unique:users',
  92. 'password' => ['required','confirmed',$password_validation],
  93. 'username' => 'required|alpha_num|unique:users|min:6',
  94. 'captcha' => 'sometimes|required',
  95. 'mobile_code' => 'required|in:'.$mobileCodes,
  96. 'country_code' => 'required|in:'.$countryCodes,
  97. 'country' => 'required|in:'.$countries,
  98. 'agree' => $agree
  99. ]);
  100. return $validate;
  101. }
  102.  
  103. public function register(Request $request)
  104. {
  105. $this->validator($request->all())->validate();
  106. $exist = User::where('mobile',$request->mobile_code.$request->mobile)->first();
  107. if ($exist) {
  108. $notify[] = ['error', 'The mobile number already exists'];
  109. return back()->withNotify($notify)->withInput();
  110. }
  111.  
  112. if (isset($request->captcha)) {
  113. if (!captchaVerify($request->captcha, $request->captcha_secret)) {
  114. $notify[] = ['error', "Invalid captcha"];
  115. return back()->withNotify($notify)->withInput();
  116. }
  117. }
  118.  
  119. event(new Registered($user = $this->create($request->all())));
  120.  
  121. $this->guard()->login($user);
  122.  
  123. return $this->registered($request, $user)
  124. ?: redirect($this->redirectPath());
  125. }
  126.  
  127.  
  128. /**
  129.   * Create a new user instance after a valid registration.
  130.   *
  131.   * @param array $data
  132.   * @return \App\User
  133.   */
  134. protected function create(array $data)
  135. {
  136. $general = GeneralSetting::first();
  137. $referBy = session()->get('reference');
  138. if ($referBy != null) {
  139. $referUser = User::where('username', $data['referBy'])->first();
  140. } else {
  141. $referUser = null;
  142. }
  143. //User Create
  144. $user = new User();
  145. $user->firstname = isset($data['firstname']) ? $data['firstname'] : null;
  146. $user->lastname = isset($data['lastname']) ? $data['lastname'] : null;
  147. $user->ref_by = ($referUser != null) ? $referUser->id : null;
  148. $user->email = strtolower(trim($data['email']));
  149. $user->password = Hash::make($data['password']);
  150. $user->username = trim($data['username']);
  151. $user->ref_by = $referUser ? $referUser->id : 0;
  152. $user->country_code = $data['country_code'];
  153. $user->mobile = $data['mobile_code'].$data['mobile'];
  154. $user->address = [
  155. 'address' => '',
  156. 'state' => '',
  157. 'zip' => '',
  158. 'country' => isset($data['country']) ? $data['country'] : null,
  159. 'city' => ''
  160. ];
  161. $user->status = 1;
  162. $user->ev = $general->ev ? 0 : 1;
  163. $user->sv = $general->sv ? 0 : 1;
  164. $user->ts = 0;
  165. $user->tv = 1;
  166. $user->save();
  167.  
  168.  
  169. $adminNotification = new AdminNotification();
  170. $adminNotification->user_id = $user->id;
  171. $adminNotification->title = 'New member registered';
  172. $adminNotification->click_url = urlPath('admin.users.detail',$user->id);
  173. $adminNotification->save();
  174.  
  175.  
  176. //Login Log Create
  177. $ip = $_SERVER["REMOTE_ADDR"];
  178. $exist = UserLogin::where('user_ip',$ip)->first();
  179. $userLogin = new UserLogin();
  180.  
  181. //Check exist or not
  182. if ($exist) {
  183. $userLogin->longitude = $exist->longitude;
  184. $userLogin->latitude = $exist->latitude;
  185. $userLogin->city = $exist->city;
  186. $userLogin->country_code = $exist->country_code;
  187. $userLogin->country = $exist->country;
  188. }else{
  189. $info = json_decode(json_encode(getIpInfo()), true);
  190. $userLogin->longitude = @implode(',',$info['long']);
  191. $userLogin->latitude = @implode(',',$info['lat']);
  192. $userLogin->city = @implode(',',$info['city']);
  193. $userLogin->country_code = @implode(',',$info['code']);
  194. $userLogin->country = @implode(',', $info['country']);
  195. }
  196.  
  197. $userAgent = osBrowser();
  198. $userLogin->user_id = $user->id;
  199. $userLogin->user_ip = $ip;
  200.  
  201. $userLogin->browser = @$userAgent['browser'];
  202. $userLogin->os = @$userAgent['os_platform'];
  203. $userLogin->save();
  204.  
  205.  
  206. return $user;
  207. }
  208.  
  209. public function checkUser(Request $request){
  210. $exist['data'] = null;
  211. $exist['type'] = null;
  212. if ($request->email) {
  213. $exist['data'] = User::where('email',$request->email)->first();
  214. $exist['type'] = 'email';
  215. }
  216. if ($request->mobile) {
  217. $exist['data'] = User::where('mobile',$request->mobile)->first();
  218. $exist['type'] = 'mobile';
  219. }
  220. if ($request->username) {
  221. $exist['data'] = User::where('username',$request->username)->first();
  222. $exist['type'] = 'username';
  223. }
  224. return response($exist);
  225. }
  226.  
  227. public function registered()
  228. {
  229. return redirect()->route('user.home');
  230. }
  231.  
  232. }
  233.  
Success #stdin #stdout 0.02s 25732KB
stdin
H
stdout
//-----------------------------------------------------------------------
// Version:        2.1
// Template name:  Finapp - Wallet & Banking HTML Mobile Template
// Item URL :      https://t...content-available-to-author-only...t.net/item/finapp-wallet-banking-html-mobile-template/25738217
// Author:         Bragher
// Author URL :    https://t...content-available-to-author-only...t.net/user/bragher
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Template Settings
//-----------------------------------------------------------------------
const Finapp = {
    //-------------------------------------------------------------------
    // PWA Settings
    PWA: {
        enable: true, // Enable or disable PWA
    },
    //-------------------------------------------------------------------
    // Dark Mode Settings
    Dark_Mode: {
        default: false, // Set dark mode as main theme
        local_mode: { // Activate dark mode between certain times of the day
            enable: false, // Enable or disable local dark mode
            start_time: 20, // Start at 20:00
            end_time: 7, // End at 07:00
        },
        auto_detect: { // Auto detect user's preferences and activate dark mode
            enable: false,
        }
    },
    //-------------------------------------------------------------------
    // Right to Left (RTL) Settings
    RTL: {
        enable: false, // Enable or disable RTL Mode
    },
    //-------------------------------------------------------------------
    // Animations
    Animation: {
        goBack: false, // Go back page animation
    },
    //-------------------------------------------------------------------
    // Test Mode
    Test: {
        enable: true, // Enable or disable test mode
        word: "testmode", // The word that needs to be typed to activate test mode
        alert: true, // Enable or disable alert when test mode is activated
        alertMessage: "Test mode activated. Look at the developer console!" // Alert message
    }
    //-------------------------------------------------------------------
}
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Elements
//-----------------------------------------------------------------------
var pageBody = document.querySelector("body");
var appSidebar = document.getElementById("sidebarPanel")
var loader =  document.getElementById('loader');
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Service Workers
//-----------------------------------------------------------------------
if (Finapp.PWA.enable) {
    if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('__service-worker.js')
            .then(reg => console.log('service worker registered'))
            .catch(err => console.log('service worker not registered - there is an error.', err));
    }
}
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Page Loader with preload
//----------------------------------------------------------------------
setTimeout(() => {
    loader.setAttribute("style", "pointer-events: none; opacity: 0; transition: 0.2s ease-in-out;");
    setTimeout(() => {
        loader.setAttribute("style", "display: none;")
    }, 1000);
}, 450);
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Go Back Animation
function goBackAnimation() {
    pageBody.classList.add("animationGoBack")
    setTimeout(() => {
        window.history.go(-1);
    }, 300);
}
// Go Back Button
var goBackButton = document.querySelectorAll(".goBack");
goBackButton.forEach(function (el) {
    el.addEventListener("click", function () {
        if (Finapp.Animation.goBack) {
            goBackAnimation();
        }
        else {
            window.history.go(-1);
        }

    })
})
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// RTL (Right to Left)
if (Finapp.RTL.enable) {
    var pageHTML = document.querySelector("html")
    pageHTML.dir = "rtl"
    document.querySelector("body").classList.add("rtl-mode")
    if (appSidebar != null) {
        appSidebar.classList.remove("panelbox-left")
        appSidebar.classList.add("panelbox-right")
    }
    document.querySelectorAll(".carousel-full, .carousel-single, .carousel-multiple, .carousel-small, .carousel-slider").forEach(function (el) {
        el.setAttribute('data-splide', '{"direction":"rtl"}')
    })
}
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Tooltip
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
    return new bootstrap.Tooltip(tooltipTriggerEl)
})
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Fix for # href
//-----------------------------------------------------------------------
var aWithHref = document.querySelectorAll('a[href*="#"]');
aWithHref.forEach(function (el) {
    el.addEventListener("click", function (e) {
        e.preventDefault();
    })
});
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Input
// Clear input
var clearInput = document.querySelectorAll(".clear-input");
clearInput.forEach(function (el) {
    el.addEventListener("click", function () {
        var parent = this.parentElement
        var input = parent.querySelector(".form-control")
        input.focus();
        input.value = "";
        parent.classList.remove("not-empty");
    })
})
// active
var formControl = document.querySelectorAll(".form-group .form-control");
formControl.forEach(function (el) {
    // active
    el.addEventListener("focus", () => {
        var parent = el.parentElement
        parent.classList.add("active")
    });
    el.addEventListener("blur", () => {
        var parent = el.parentElement
        parent.classList.remove("active")
    });
    // empty check
    el.addEventListener("keyup", log);
    function log(e) {
        var inputCheck = this.value.length;
        if (inputCheck > 0) {
            this.parentElement.classList.add("not-empty")
        }
        else {
            this.parentElement.classList.remove("not-empty")
        }
    }
})
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Searchbox Toggle
var searchboxToggle = document.querySelectorAll(".toggle-searchbox")
searchboxToggle.forEach(function (el) {
    el.addEventListener("click", function () {
        var search = document.getElementById("search")
        var a = search.classList.contains("show")
        if (a) {
            search.classList.remove("show")
        }
        else {
            search.classList.add("show")
            search.querySelector(".form-control").focus();
        }
    })
});
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Carousel
// Splide Carousel
document.addEventListener('DOMContentLoaded', function () {

    // Full Carousel
    document.querySelectorAll('.carousel-full').forEach(carousel => new Splide(carousel, {
        perPage: 1,
        rewind: true,
        type: "loop",
        gap: 0,
        arrows: false,
        pagination: false,
    }).mount());

    // Single Carousel
    document.querySelectorAll('.carousel-single').forEach(carousel => new Splide(carousel, {
        perPage: 3,
        rewind: true,
        type: "loop",
        gap: 16,
        padding: 16,
        arrows: false,
        pagination: false,
        breakpoints: {
            768: {
                perPage: 1
            },
            991: {
                perPage: 2
            }
        }
    }).mount());

    // Multiple Carousel
    document.querySelectorAll('.carousel-multiple').forEach(carousel => new Splide(carousel, {
        perPage: 4,
        rewind: true,
        type: "loop",
        gap: 16,
        padding: 16,
        arrows: false,
        pagination: false,
        breakpoints: {
            768: {
                perPage: 2
            },
            991: {
                perPage: 3
            }
        }
    }).mount());

    // Small Carousel
    document.querySelectorAll('.carousel-small').forEach(carousel => new Splide(carousel, {
        perPage: 9,
        rewind: false,
        type: "loop",
        gap: 16,
        padding: 16,
        arrows: false,
        pagination: false,
        breakpoints: {
            768: {
                perPage: 4
            },
            991: {
                perPage: 7
            }
        }
    }).mount());

    // Slider Carousel
    document.querySelectorAll('.carousel-slider').forEach(carousel => new Splide(carousel, {
        perPage: 1,
        rewind: false,
        type: "loop",
        gap: 16,
        padding: 16,
        arrows: false,
        pagination: true
    }).mount());

    // Stories Carousel
    document.querySelectorAll('.story-block').forEach(carousel => new Splide(carousel, {
        perPage: 16,
        rewind: false,
        type: "slide",
        gap: 16,
        padding: 16,
        arrows: false,
        pagination: false,
        breakpoints: {
            500: {
                perPage: 4
            },
            768: {
                perPage: 7
            },
            1200: {
                perPage: 11
            }
        }
    }).mount());
});
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Upload Input
var uploadComponent = document.querySelectorAll('.custom-file-upload');
uploadComponent.forEach(function (el) {
    var fileUploadParent = '#' + el.id;
    var fileInput = document.querySelector(fileUploadParent + ' input[type="file"]')
    var fileLabel = document.querySelector(fileUploadParent + ' label')
    var fileLabelText = document.querySelector(fileUploadParent + ' label span')
    var filelabelDefault = fileLabelText.innerHTML;
    fileInput.addEventListener('change', function (event) {
        var name = this.value.split('\\').pop()
        tmppath = URL.createObjectURL(event.target.files[0]);
        if (name) {
            fileLabel.classList.add('file-uploaded');
            fileLabel.style.backgroundImage = "url(" + tmppath + ")";
            fileLabelText.innerHTML = name;
        }
        else {
            fileLabel.classList.remove("file-uploaded")
            fileLabelText.innerHTML = filelabelDefault;
        }
    })
})
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Notification
// trigger notification
var notificationCloseButton = document.querySelectorAll(".notification-box .close-button");
var notificationTaptoClose = document.querySelectorAll(".tap-to-close .notification-dialog");
var notificationBox = document.querySelectorAll(".notification-box");

function closeNotificationBox() {
    notificationBox.forEach(function (el) {
        el.classList.remove("show")
    })
}
function notification(target, time) {
    var a = document.getElementById(target);
    closeNotificationBox()
    setTimeout(() => {
        a.classList.add("show")
    }, 250);
    if (time) {
        time = time + 250;
        setTimeout(() => {
            closeNotificationBox()
        }, time);
    }
}
// close notification
notificationCloseButton.forEach(function (el) {
    el.addEventListener("click", function (e) {
        e.preventDefault();
        closeNotificationBox();
    })
});

// tap to close notification
notificationTaptoClose.forEach(function (el) {
    el.addEventListener("click", function (e) {
        closeNotificationBox();
    })
});
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Toast
// trigger toast
var toastCloseButton = document.querySelectorAll(".toast-box .close-button");
var toastTaptoClose = document.querySelectorAll(".toast-box.tap-to-close");
var toastBoxes = document.querySelectorAll(".toast-box");

function closeToastBox() {
    toastBoxes.forEach(function (el) {
        el.classList.remove("show")
    })
}
function toastbox(target, time) {
    var a = document.getElementById(target);
    closeToastBox()
    setTimeout(() => {
        a.classList.add("show")
    }, 100);
    if (time) {
        time = time + 100;
        setTimeout(() => {
            closeToastBox()
        }, time);
    }
}
// close button toast
toastCloseButton.forEach(function (el) {
    el.addEventListener("click", function (e) {
        e.preventDefault();
        closeToastBox();
    })
})
// tap to close toast
toastTaptoClose.forEach(function (el) {
    el.addEventListener("click", function (e) {
        closeToastBox();
    })
})
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Add to Home
var osDetection = navigator.userAgent || navigator.vendor || window.opera;
var windowsPhoneDetection = /windows phone/i.test(osDetection);
var androidDetection = /android/i.test(osDetection);
var iosDetection = /iPad|iPhone|iPod/.test(osDetection) && !window.MSStream;

function iosAddtoHome() {
    var modal = new bootstrap.Modal(document.getElementById('ios-add-to-home-screen'))
    modal.toggle()
}
function androidAddtoHome() {
    var modal = new bootstrap.Modal(document.getElementById('android-add-to-home-screen'))
    modal.toggle()
}
function AddtoHome(time, once) {
    if (once) {
        var AddHomeStatus = localStorage.getItem("FinappAddtoHome");
        if (AddHomeStatus === "1" || AddHomeStatus === 1) {
            // already showed up
        }
        else {
            localStorage.setItem("FinappAddtoHome", 1)
            window.addEventListener('load', () => {
                if (navigator.standalone) {
                    // if app installed ios home screen
                }
                else if (matchMedia('(display-mode: standalone)').matches) {
                    // if app installed android home screen
                }
                else {
                    // if app is not installed
                    if (androidDetection) {
                        setTimeout(() => {
                            androidAddtoHome()
                        }, time);
                    }
                    if (iosDetection) {
                        setTimeout(() => {
                            iosAddtoHome()
                        }, time);
                    }
                }
            });
        }
    }
    else {
        window.addEventListener('load', () => {
            if (navigator.standalone) {
                // app loaded to ios
            }
            else if (matchMedia('(display-mode: standalone)').matches) {
                // app loaded to android
            }
            else {
                // app not loaded
                if (androidDetection) {
                    setTimeout(() => {
                        androidAddtoHome()
                    }, time);
                }
                if (iosDetection) {
                    setTimeout(() => {
                        iosAddtoHome()
                    }, time);
                }
            }
        });
    }

}
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Dark Mode
var checkDarkModeStatus = localStorage.getItem("FinappDarkmode");
var switchDarkMode = document.querySelectorAll(".dark-mode-switch");
var pageBodyActive = pageBody.classList.contains("dark-mode");

// Check if enable as default
if (Finapp.Dark_Mode.default) {
    pageBody.classList.add("dark-mode");
}

// Local Dark Mode
if (Finapp.Dark_Mode.local_mode.enable) {
    var nightStart = Finapp.Dark_Mode.local_mode.start_time;
    var nightEnd = Finapp.Dark_Mode.local_mode.end_time;
    var currentDate = new Date();
    var currentHour = currentDate.getHours();
    if (currentHour >= nightStart || currentHour < nightEnd) {
        // It is night time
        pageBody.classList.add("dark-mode");
    }
}

// Auto Detect Dark Mode
if (Finapp.Dark_Mode.auto_detect.enable)
    if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
        pageBody.classList.add("dark-mode");
    }

function switchDarkModeCheck(value) {
    switchDarkMode.forEach(function (el) {
        el.checked = value
    })
}
// if dark mode on
if (checkDarkModeStatus === 1 || checkDarkModeStatus === "1" || pageBody.classList.contains('dark-mode')) {
    switchDarkModeCheck(true);
    if (pageBodyActive) {
        // dark mode already activated
    }
    else {
        pageBody.classList.add("dark-mode")
    }
}
else {
    switchDarkModeCheck(false);
}
switchDarkMode.forEach(function (el) {
    el.addEventListener("click", function () {
        var darkmodeCheck = localStorage.getItem("FinappDarkmode");
        var bodyCheck = pageBody.classList.contains('dark-mode');
        if (darkmodeCheck === 1 || darkmodeCheck === "1" || bodyCheck) {
            pageBody.classList.remove("dark-mode");
            localStorage.setItem("FinappDarkmode", "0");
            switchDarkModeCheck(false);
        }
        else {
            pageBody.classList.add("dark-mode")
            switchDarkModeCheck(true);
            localStorage.setItem("FinappDarkmode", "1");
        }
    })
})
//-----------------------------------------------------------------------


//-----------------------------------------------------------------------
// Test Mode
function testMode() {
    var colorDanger = "color: #FF396F; font-weight:bold;"
    var colorSuccess = "color: #1DCC70; font-weight:bold;"

    console.clear();
    console.log("%cFINAPP", "font-size: 1.3em; font-weight: bold; color: #FFF; background-color: #6236FF; padding: 10px 120px; margin-bottom: 16px;")
    console.log("%c🚀 TEST MODE ACTIVATED ..!", "font-size: 1em; font-weight: bold; margin: 4px 0;");

    function testModeMsg(value, msg) {
        if (value) {
            console.log("%c|" + "%c " + msg + " : " + "%cEnabled", "color: #444; font-size :1.2em; font-weight: bold;", "color: inherit", colorSuccess);
        }
        else if (value == false) {
            console.log("%c|" + "%c " + msg + " : " + "%cDisabled", "color: #444; font-size :1.2em; font-weight: bold;", "color: inherit", colorDanger);
        }
    }
    function testModeInfo(value, msg) {
        console.log("%c|" + "%c " + msg + " : " + "%c" + value, "color: #444; font-size :1.2em; font-weight: bold;", "color: inherit", "color:#6236FF; font-weight: bold;");
    }
    function testModeSubtitle(msg) {
        console.log("%c # " + msg, "color: #FFF; background: #444; font-size: 1.2em; padding: 8px 16px; margin-top: 16px; border-radius: 12px 12px 0 0");
    }

    testModeSubtitle("THEME SETTINGS")
    testModeMsg(Finapp.PWA.enable, "PWA")
    testModeMsg(Finapp.Dark_Mode.default, "Set dark mode as default theme")
    testModeMsg(Finapp.Dark_Mode.local_mode.enable, "Local dark mode (between " + Finapp.Dark_Mode.local_mode.start_time + ":00 and " + Finapp.Dark_Mode.local_mode.end_time + ":00)")
    testModeMsg(Finapp.Dark_Mode.auto_detect.enable, "Auto detect dark mode")
    testModeMsg(Finapp.RTL.enable, "RTL")
    testModeMsg(Finapp.Test.enable, "Test mode")
    testModeMsg(Finapp.Test.alert, "Test mode alert")

    testModeSubtitle("PREVIEW INFOS")
    // Resolution
    testModeInfo(window.screen.availWidth + " x " + window.screen.availHeight, "Resolution")
    // Device
    if (iosDetection) {
        testModeInfo("iOS", "Device")
    }
    else if (androidDetection) {
        testModeInfo("Android", "Device")
    }
    else if (windowsPhoneDetection) {
        testModeInfo("Windows Phone", "Device")
    }
    else {
        testModeInfo("Not a Mobile Device", "Device")
    }
    //Language
    testModeInfo(window.navigator.language, "Language")
    // Theme
    if (pageBody.classList.contains("dark-mode")) {
        testModeInfo("Dark Mode", "Current theme")
    }
    else {
        testModeInfo("Light Mode", "Current theme")
    }
    // Online Status
    if (window.navigator.onLine) {
        testModeInfo("Online", "Internet connection")
    }
    else {
        testModeInfo("Offline", "Internet connection")
    }

    testModeSubtitle("ANIMATIONS")
    testModeMsg(Finapp.Animation.goBack, "Go Back")
}
function themeTesting() {
    var word = Finapp.Test.word;
    var value = "";
    window.addEventListener('keypress', function (e) {
        value = value + String.fromCharCode(e.keyCode).toLowerCase();
        if (value.length > word.length) {
            value = value.slice(1);
        }
        if (value == word || value === word) {
            value = ""
            if (Finapp.Test.alert) {
                var content = document.getElementById("appCapsule")
                content.appendChild(document.createElement("div")).className = "test-alert-wrapper";
                var alert =
                    "<div id='alert-toast' class='toast-box toast-center tap-to-close'>"
                    +
                    "<div class='in'>"
                    +
                    "<div class='text'><h1 class='text-light mb-05'>🤖</h1><strong>"
                    +
                    Finapp.Test.alertMessage
                    +
                    "</strong></div></div></div>"
                var wrapper = document.querySelector(".test-alert-wrapper")
                wrapper.innerHTML = alert;
                toastbox('alert-toast');
                setTimeout(() => {
                    this.document.getElementById("alert-toast").classList.remove("show")
                }, 4000);
            }
            testMode();
        }

    })
}

if (Finapp.Test.enable) {
    themeTesting();
}
//-----------------------------------------------------------------------