Skip to content

Commit

Permalink
added inactivity logout
Browse files Browse the repository at this point in the history
  • Loading branch information
milon27 committed Jul 24, 2021
1 parent 2bf9d02 commit a3cbbd7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 44 deletions.
16 changes: 8 additions & 8 deletions src/components/navigation/AppNavContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ export default function AppNavContainer() {

return (
<>
{/* <UserInactivity
<UserInactivity
isActive={active}
timeForInactivity={30000}
timeForInactivity={240000}
onAction={(a) => {
setactive(a)
}}
> */}
<NavigationContainer>
{auth?.logged_in ? <DashDrawNav /> : <AuthNav />}
{/* <DashDrawNav /> */}
</NavigationContainer >
{/* </UserInactivity> */}
>
<NavigationContainer>
{auth?.logged_in ? <DashDrawNav /> : <AuthNav />}
{/* <DashDrawNav /> */}
</NavigationContainer >
</UserInactivity>
</>
)
}
2 changes: 1 addition & 1 deletion src/components/navigation/DashStackNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function DashStackNav() {
<dashStack.Screen name={URL.HOME_SCREEN} component={HomeScreen}
options={
{
title: "M27Lab Password.",
title: "PASSWORDZ",
// align-left
headerLeft: () => (<Icon size={28} type={DefineIcon.Feather} style={{ paddingHorizontal: 25 }} name="settings" onPress={() => { nav.toggleDrawer() }} />),
headerRight: () => {
Expand Down
60 changes: 26 additions & 34 deletions src/components/screens/auth/SignUp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import React, { useState, useContext } from 'react'
import { StyleSheet, Text, Keyboard } from 'react-native';
import { StyleSheet, Text, Keyboard, ScrollView } from 'react-native';
import Container from './../../layouts/Container';
import Helper from './../../../utils/helpers/Helper';
import Input from '../../layouts/form/Input';
Expand Down Expand Up @@ -39,14 +39,6 @@ export default function SignUp() {
const [input, setInput] = useState(init)
const [error, setError] = useState(init)

// downloadTxtFile = () => {
// const element = document.createElement("a");
// const file = new Blob([document.getElementById('myInput').value], { type: 'text/plain' });
// element.href = URL.createObjectURL(file);
// element.download = "myFile.txt";
// document.body.appendChild(element); // Required for this to work in FireFox
// element.click();
// }
const onSubmit = async () => {
//validation
const errorArray = Helper.validateObject(input)//should pass an object with key:value
Expand Down Expand Up @@ -91,35 +83,38 @@ export default function SignUp() {
}

return (
<Container style={styles.container}>
<StatusBar style={Theme.STATUS_BAR} />
<Text style={styles.title}>Create Account Now</Text>
<ScrollView style={{ backgroundColor: Theme.COLOR_BG }}>

<ResponseLayout response={app?.response} />
<Container style={{ paddingTop: 30 }}>
<StatusBar style={Theme.STATUS_BAR} />
<Text style={styles.title}>Create Account Now</Text>

<Input value={input.email}
icon={<Icon type={DefineIcon.MaterialIcon} size={17} name="alternate-email" />}
error={error?.email}
onChangeText={(text) => Helper.onChange({ name: N_EMAIL, value: text, setInput: setInput, setError: setError })} label="Enter Your Email" />
<ResponseLayout response={app?.response} />

<Input value={input.name} error={error?.name}
icon={<Icon type={DefineIcon.Feather} size={17} name="user" />}
onChangeText={(text) => Helper.onChange({ name: N_NAME, value: text, setInput: setInput, setError: setError })} label="Enter Your Name" />
<Input value={input.email}
icon={<Icon type={DefineIcon.MaterialIcon} size={17} name="alternate-email" />}
error={error?.email}
onChangeText={(text) => Helper.onChange({ name: N_EMAIL, value: text, setInput: setInput, setError: setError })} label="Enter Your Email" />

<Input value={input[N_PASSWORD]} error={error[N_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Enter Master Password" />
<Input value={input.name} error={error?.name}
icon={<Icon type={DefineIcon.Feather} size={17} name="user" />}
onChangeText={(text) => Helper.onChange({ name: N_NAME, value: text, setInput: setInput, setError: setError })} label="Enter Your Name" />

<Input value={input[N_C_PASSWORD]} error={error[N_C_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
onChangeText={(text) => Helper.onChange({ name: N_C_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Confirm Master Password" />
<Input value={input[N_PASSWORD]} error={error[N_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Enter Master Password" />

<MButton title="Sign Up Now" loading={app?.loading} color={Theme.COLOR_PRIMARY} onPress={onSubmit} disabled={app?.loading} />
{/* while loading.. it should be disabled */}
<Text style={styles.small_title1}>You can't reset master password,so don't forget it.</Text>
<NavLink title="Already have an account? Login Now" url={URL.SIGN_IN}></NavLink>
<Input value={input[N_C_PASSWORD]} error={error[N_C_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
onChangeText={(text) => Helper.onChange({ name: N_C_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Confirm Master Password" />

</Container>
<MButton title="Sign Up Now" loading={app?.loading} color={Theme.COLOR_PRIMARY} onPress={onSubmit} disabled={app?.loading} />
{/* while loading.. it should be disabled */}
<Text style={styles.small_title1}>You can only change master password but can't recover master password if you forget it.So remember the master password.</Text>
<NavLink title="Already have an account? Login Now" url={URL.SIGN_IN}></NavLink>

</Container>
</ScrollView>
);
}

Expand Down Expand Up @@ -149,8 +144,5 @@ const styles = StyleSheet.create({
fontSize: 25,
marginVertical: 15,
padding: 7
},
container: {
justifyContent: "center"
}
})
2 changes: 1 addition & 1 deletion src/utils/helpers/Define.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Define = {
API_BASE_URL: "http://192.168.4.65:2727/",//https://password-manager-api-27.herokuapp.com/,http://192.168.4.65:2727/
API_BASE_URL: "https://password-manager-api-27.herokuapp.com/",//https://password-manager-api-27.herokuapp.com/,http://192.168.4.65:2727/
//time format
FORMAT_DATE: "DD-MM-YYYY",
//bootstrap color
Expand Down

0 comments on commit a3cbbd7

Please sign in to comment.