diff --git a/mobile/android/rename-apk b/mobile/android/rename-apk index 471716e..43fe558 100755 --- a/mobile/android/rename-apk +++ b/mobile/android/rename-apk @@ -6,3 +6,5 @@ VERSION=$(cat $SCRIPT_DIR/../../scratch/version.txt) NEW_APK=$(dirname $OLD_APK)/deighton-ar-${VERSION}.apk mv $OLD_APK $NEW_APK + +echo $NEW_APK \ No newline at end of file diff --git a/mobile/package.json b/mobile/package.json index c242307..7e6d708 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -12,7 +12,7 @@ "scripts": { "start": "react-native start", "android": "react-native run-android", - "android:release": "cd android; rm -rf ./app/build && ./gradlew assembleRelease", + "android:release": "cd android; rm -rf ./app/build && ./gradlew assembleRelease && ./rename-apk", "ios": "react-native run-ios", "test": "node node_modules/jest/bin/jest.js", "postinstall": "sed -i '' 's/#import /#import \"RCTValueAnimatedNode.h\"/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h; sed -i '' 's/#import /#import \"fishhook.h\"/' ./node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m" diff --git a/mobile/src/Auth/Login.js b/mobile/src/Auth/Login.js index 6f2ffcb..ce0fdf5 100644 --- a/mobile/src/Auth/Login.js +++ b/mobile/src/Auth/Login.js @@ -89,7 +89,7 @@ export class Login extends React.Component { if (obj) { api - .login(obj.email, obj.password, obj.rememberMe) + .login(obj.email.trim(), obj.password, obj.rememberMe) .then((user) => { history.replace("/home") }) diff --git a/mobile/src/config.js b/mobile/src/config.js index fc23249..6c62150 100644 --- a/mobile/src/config.js +++ b/mobile/src/config.js @@ -1,5 +1,5 @@ export const localIPAddr = "192.168.1.175" -export const defaultUser = "john@lyon-smith.org" -//export const defaultUser = "" +//export const defaultUser = "john@lyon-smith.org" +export const defaultUser = "" // export const minGPSAccuracy = 20 export const minGPSAccuracy = 100 diff --git a/server/package.json b/server/package.json index 32a1818..4060672 100644 --- a/server/package.json +++ b/server/package.json @@ -7,7 +7,7 @@ "start": "babel-node src/server.js", "start:prod": "NODE_ENV=production node dist/server.js", "build": "rm -rf dist && babel src -d dist -s", - "deploy": "rsync -vr -e ssh --exclude-from .rsync-exclude * ubuntu@tmr:deighton-ar/server/ && ssh ubuntu@tmr 'cd deighton-ar/server && npm install'", + "deploy": "rsync -vr -e ssh --exclude-from .rsync-exclude * ubuntu@gs-1:deighton-ar/server/ && ssh ubuntu@gs-1 'cd deighton-ar/server && npm install'", "test": "jest", "actor:api": "monzilla 'src/api/**/*.js:src/database/**/*.js' -- babel-node src/api/index.js", "actor:api:debug": "babel-node --inspect-brk src/api/index.js", diff --git a/server/src/api/routes/AuthRoutes.js b/server/src/api/routes/AuthRoutes.js index 916cf9b..c7e8f4e 100644 --- a/server/src/api/routes/AuthRoutes.js +++ b/server/src/api/routes/AuthRoutes.js @@ -110,7 +110,7 @@ export class AuthRoutes { res.set("Authorization", `Bearer ${savedUser.loginToken}`) res.json(savedUser.toClient()) } else { - throw createError.BadRequest("email or password incorrect") + throw createError.BadRequest("Email or password incorrect") } } diff --git a/website/package.json b/website/package.json index 5639bcb..08e9aa4 100644 --- a/website/package.json +++ b/website/package.json @@ -61,7 +61,7 @@ "scripts": { "start": "node scripts/start.js", "build": "node scripts/build.js", - "deploy": "rsync -vr -e ssh build/* ubuntu@tmr:deighton-ar/website/", + "deploy": "rsync -vr -e ssh build/* ubuntu@gs-1:deighton-ar/website/", "lint": "eslint --ext .js --ext .jsx src/", "lint:fix": "eslint --ext .js --ext .jsx --fix src/" }, diff --git a/website/src/Auth/Login.js b/website/src/Auth/Login.js index d026922..ae8289c 100644 --- a/website/src/Auth/Login.js +++ b/website/src/Auth/Login.js @@ -1,37 +1,47 @@ -import React, { Component, Fragment } from 'react' -import PropTypes from 'prop-types' -import { regExpPattern } from 'regexp-pattern' -import { api } from 'src/API' -import { WaitModal, MessageModal } from '../Modal' -import { Box, Image, Link, Text, Row, Column, BoundInput, BoundCheckbox, BoundButton } from 'ui' -import headerLogo from 'images/deighton.png' -import { versionInfo } from '../version' -import { FormBinder } from 'react-form-binder' -import autobind from 'autobind-decorator' -import { sizeInfo, colorInfo } from 'ui/style' +import React, { Component, Fragment } from "react" +import PropTypes from "prop-types" +import { regExpPattern } from "regexp-pattern" +import { api } from "src/API" +import { WaitModal, MessageModal } from "../Modal" +import { + Box, + Image, + Link, + Text, + Row, + Column, + BoundInput, + BoundCheckbox, + BoundButton, +} from "ui" +import headerLogo from "images/deighton.png" +import { versionInfo } from "../version" +import { FormBinder } from "react-form-binder" +import autobind from "autobind-decorator" +import { sizeInfo, colorInfo } from "ui/style" export class Login extends Component { static propTypes = { - history: PropTypes.oneOfType([PropTypes.array, PropTypes.object]) + history: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), } static bindings = { email: { alwaysGet: true, - isValid: (r, v) => (regExpPattern.email.test(v)) + isValid: (r, v) => regExpPattern.email.test(v), }, password: { alwaysGet: true, - isValid: (r, v) => (v !== '') + isValid: (r, v) => v !== "", }, rememberMe: { alwaysGet: true, - initValue: true + initValue: true, }, submit: { noValue: true, - isDisabled: (r) => (!r.anyModified || !r.allValid) - } + isDisabled: (r) => !r.anyModified || !r.allValid, + }, } constructor(props) { @@ -39,7 +49,7 @@ export class Login extends Component { this.state = { waitModal: false, messageModal: null, - binder: new FormBinder({}, Login.bindings) + binder: new FormBinder({}, Login.bindings), } } @@ -59,23 +69,31 @@ export class Login extends Component { if (obj) { this.setState({ waitModal: true }) - api.login(obj.email, obj.password, obj.rememberMe).then((user) => { - this.setState({ waitModal: false }) - if (this.props.history) { - let url = new URLSearchParams(window.location.search).get('redirect') || '/' + api + .login(obj.email.trim(), obj.password, obj.rememberMe) + .then((user) => { + this.setState({ waitModal: false }) + if (this.props.history) { + let url = + new URLSearchParams(window.location.search).get("redirect") || "/" - try { - this.props.history.replace(url) - } catch (error) { - this.props.history.replace('/') + try { + this.props.history.replace(url) + } catch (error) { + this.props.history.replace("/") + } } - } - }).catch((error) => { - this.setState({ - waitModal: false, - messageModal: { icon: 'hand', message: `Unable to login`, detail: error.message } }) - }) + .catch((error) => { + this.setState({ + waitModal: false, + messageModal: { + icon: "hand", + message: `Unable to login`, + detail: error.message, + }, + }) + }) } } @@ -83,10 +101,13 @@ export class Login extends Component { handleMessageModalDismiss() { this.setState({ messageModal: null, - binder: new FormBinder({ email: this.state.binder.getFieldValue('email') }, Login.bindings) + binder: new FormBinder( + { email: this.state.binder.getFieldValue("email") }, + Login.bindings + ), }) - const elems = document.getElementsByName('password') + const elems = document.getElementsByName("password") if (elems) { elems[0].focus() @@ -103,8 +124,13 @@ export class Login extends Component { -
- + + @@ -114,33 +140,51 @@ export class Login extends Component { - + - Login + Login - + - + - Forgot your password? + + Forgot your password? + - + @@ -149,14 +193,23 @@ export class Login extends Component { - + - Please contact {versionInfo.supportEmail} to request login credentials. + Please contact{" "} + + {versionInfo.supportEmail} + {" "} + to request login credentials. @@ -171,12 +224,15 @@ export class Login extends Component { - - + + )