Skip to content

Commit

Permalink
First steps toward verify email address
Browse files Browse the repository at this point in the history
useFetchData now takes a METHOD parameter to handle get/push
Login has been updated, but still needs both the client and server to run in SSL/TLS to be able to send emails.
Many lint fixes
"Dependency cycle"  errors were fixed by pulling some functions that did need access to ConnectAppContext outside of files that did not, and were included in ConnectAppContext and some other places other places -- I'm not attached to this form of refactor if someone has a better way to avoid "Dependency cycle"s
Added back (in parallel to the takes an id approach) to allow determining the "FullNamePreferred" string within maps ... getFullNamePreferredPerson = (person)
  • Loading branch information
SailingSteve committed Feb 4, 2025
1 parent 8682330 commit ecbda3b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/js/common/utils/cordovaUtils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import webAppConfig from '../../config';
import { isAndroid, isAndroidTablet, isCordova, isWebApp } from './isCordovaOrWebApp';
import { cordovaOffsetLog, oAuthLog } from './logging';
import { cordovaOffsetLog, authLog } from './logging';

/* global $ */

Expand Down Expand Up @@ -76,26 +76,26 @@ export function cordovaOpenSafariViewSub (requestURL, onExit) {
if (isIOS()) {
console.log(`cordovaOpenSafariView -1- requestURL: ${requestURL}`);
SafariViewController.isAvailable(() => { // eslint-disable-line no-undef
oAuthLog(`cordovaOpenSafariView requestURL: ${requestURL}`);
authLog(`cordovaOpenSafariView requestURL: ${requestURL}`);
SafariViewController.show({ // eslint-disable-line no-undef
url: requestURL,
dismissButton: 1,
},
(result) => {
if (result.event === 'opened') {
oAuthLog(`cordovaOpenSafariView opened url: ${requestURL}`);
authLog(`cordovaOpenSafariView opened url: ${requestURL}`);
} else if (result.event === 'loaded') {
oAuthLog(`cordovaOpenSafariView URL result from loading: ${JSON.stringify(result)}`);
authLog(`cordovaOpenSafariView URL result from loading: ${JSON.stringify(result)}`);
} else if (result.event === 'closed') {
oAuthLog(`cordovaOpenSafariView closed: ${JSON.stringify(result)}`);
authLog(`cordovaOpenSafariView closed: ${JSON.stringify(result)}`);
if (onExit) {
onExit();
}
}
},

(msg) => {
oAuthLog(`cordovaOpenSafariView KO: ${JSON.stringify(msg)}`);
authLog(`cordovaOpenSafariView KO: ${JSON.stringify(msg)}`);
});
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/js/common/utils/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function httpLog (text, res) {
}

// Log oAuth steps
export function oAuthLog (text, res) {
if (webAppConfig.LOG_SIGNIN_STEPS) {
export function authLog (text, res) {
if (webAppConfig.LOG_AUTHENTICATION) {
if (res) {
console.log('>> oAuth >> ', text, res);
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/js/components/PrivateRoute.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { Navigate, Outlet, useLocation } from 'react-router';
import { authLog } from '../common/utils/logging';
import { useConnectAppContext } from '../contexts/ConnectAppContext';

const PrivateRoute = () => {
const { getAppContextValue } = useConnectAppContext();
const isAuthenticated = getAppContextValue('isAuthenticated');
console.log('========= PrivateRoute =========== isAuthenticated: ', isAuthenticated);
authLog('========= PrivateRoute =========== isAuthenticated: ', isAuthenticated);
const location = useLocation();

return isAuthenticated ? <Outlet /> : <Navigate to="/login" state={{ from: location }} replace />;
Expand Down
2 changes: 1 addition & 1 deletion src/js/config-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {
LOG_ONLY_FIRST_RENDER_EVENTS: false,
LOG_HTTP_REQUESTS: false,
LOG_ROUTING: false,
LOG_SIGNIN_STEPS: false, // oAuthLog function prints to console
LOG_AUTHENTICATION: false, // authLog function prints to console
LOG_CORDOVA_OFFSETS: false,
SHOW_CORDOVA_URL_FIELD: false, // Only needed for debugging in Cordova
ENABLE_REACT_QUERY_TOOLS: false, // Show ReactQueryDevtools icon/console
Expand Down

0 comments on commit ecbda3b

Please sign in to comment.