Displaying differences for changeset
 
display as  

config.yml

@@ -10,7 +10,7 @@
 # The current version of your application.  This will be advertised
 # through your REST API, and should take the form
 # "<major_version>.<minor_version>.<patch>".
-version: 0.5.2
+version: 0.5.3
 
 # The kind of application.  Currently eRAMS supports two kinds of applications, `system` and `app`.
 # System apps have pre-configured installation and configurations, while all `app` applications are

services.py

@@ -67,91 +67,6 @@
                 version=get_version(), meta=meta))
     return [dict(url) for url in api_urls]
 
-
-def er2_login_disable_oauth(default):
-    return True
-
-
-def er2_login_enable_direct_sign_in(default):
-    return True
-
-
-def er2_login_get_page_name(default=None):
-    return "Edge of Field Database"
-
-
-def er2_login_scratch_project_url(default):
-    return {
-        "name": "New Project",
-        "url": "/?token=_new",
-    }
-
-
-def hash_password(password):
-    """Hash a password for storing."""
-    salt = hashlib.sha256(os.urandom(60)).hexdigest().encode("ascii")
-    pwdhash = hashlib.pbkdf2_hmac(
-        "sha512", password.encode("utf-8"), salt, 100000)
-    pwdhash = binascii.hexlify(pwdhash)
-    return (salt + pwdhash).decode("ascii")
-
-
-def verify_password(stored_password, provided_password):
-    """Verify a stored password against one provided by user"""
-    import hashlib
-    import binascii
-
-    salt = stored_password[:64]
-    stored_password = stored_password[64:]
-    pwdhash = hashlib.pbkdf2_hmac(
-        "sha512", provided_password.encode(
-            "utf-8"), salt.encode("ascii"), 100000
-    )
-    pwdhash = binascii.hexlify(pwdhash).decode("ascii")
-    return pwdhash == stored_password
-
-
-# TODO: I would think this could be moved directly into er2_login/services.py
-def er2_login_handle_authentication(request, user_attrs):
-    user_id, email, first_name, last_name, attrs = [None] * 5
-    if "username" in user_attrs:
-        users_path = "/gis_data/users/users_eofdb_hashed.json"
-        with open(users_path) as fp:
-            users = json.load(fp)["users"]
-        user_info = users.get(user_attrs["username"], None)
-        if user_info:
-            pw_hashed = user_info["password"]
-            if verify_password(pw_hashed, user_attrs["password"]):
-                user_id = user_attrs["username"]
-                attrs = {
-                    "projects": [
-                        {
-                            "name": user_id,
-                            "type": "eofDB",
-                            "url": "/?token={0}".format(user_info["project"]),
-                        },
-                    ],
-                }
-                request.session["token"] = user_info["project"]
-            else:
-                raise LoginException("Login failed")
-        else:
-            raise LoginException("User does not exist")
-    else:
-        # anonymous login
-        attrs = {
-            "projects": [
-                {
-                    "name": "guest",
-                    "type": "eofdb",
-                    "url": "/?token={0}".format(er2_strings.rand()),
-                },
-            ],
-        }
-
-    return user_id, email, first_name, last_name, attrs
-
-
 logger = logging.getLogger('er2')
 
 class State(er2_state.State):

static/er2_eofDB/js/containers/app.tsx

@@ -114,6 +114,7 @@
     onUpdateMapView: Function,
     onUploadLocal: Function,
     setAdvancedSetting: Function,
+    setDefaultBaseLayer: Function,
     setFeatureBorderWidth: Function,
     setFeatureColor: Function,
     setFeatureOpacity: Function,
@@ -241,7 +242,6 @@
     const { keycloak, setCurrentToken, userState } = catenaKeycloak
     const users = useSelector(state => state.users)
 
-
     const catenaMap = React.useRef(null)
     const { location } = window
     const parsedLoc = parseLocation(window.location)
@@ -260,13 +260,14 @@
     const dispatch = useDispatch()
     const { token, actions } = theprops
     const { fetchState } = actions
+    const [userRoleConservationist, setUserRoleConservationist] = React.useState(false)
 
-    const [userRoleConservationist, setUserRoleConservationist] = React.useState(false)
+    console.log({token: token.value})
 
     useEffect(() => {
         if (keycloak.authenticated && userState) {
             const currentToken = userState.currentToken
-
+            
             // First check for initial load of project (token will be null)
             if (!token.value) {
                 if (currentToken) {
@@ -302,7 +303,6 @@
 
 
     useEffect(() => {
-        console.log(users)
         if (users.user.id) {
             setUserRoleConservationist('Conservationist' === users.user['role'])
         }
@@ -332,13 +332,9 @@
 
     useEffect(() => {
         theprops.actions.getUsersFromDB()
+        theprops.actions.setDefaultBaseLayer('USGS Imagery Topo')
     }, [])
 
-
-    const logout = () => {
-        keycloak.logout()
-    }
-
     function renderHeader() {
         let loginSection
 

static/er2_eofDB/js/reducers/index.ts

@@ -6,6 +6,7 @@
     logger,
     map,
     mapsources,
+    mapBaseLayer,
     publicSites,
     tabbedPanel,
     theme,
@@ -15,7 +16,6 @@
 import contextBar from './context_bar'
 import tableOfContents from './table_of_contents'
 import mapToolbar from './map_toolbar'
-import mapBaseLayer from './mapbaselayer'
 import meta from './meta'
 import run from './run'
 import manageProjects from './manageProjects'

static/er2_eofDB/js/reducers/manageProjects.tsx

@@ -587,7 +587,7 @@
         ['members']: editedProjectMembers,
         undoProject: { ...p },
       }
-      console.log('newProject with updated members ====>', newProject)
+      console.debug('newProject with updated members ====>', newProject)
       projects.push(newProject)
     })
     newState = { ...state, projects, areProjectsDirty: true }

static/package.json

@@ -1,6 +1,6 @@
 {
   "name": "er2_eofdb",
-  "version": "0.5.2",
+  "version": "0.5.3",
   "target": "web",
   "module": "index.js",
   "license": "MIT",