Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * GRAPECITY MONGOLIA LLC
- * PAYMENT SOLUTION DIVISION
- * Bilguun.B
- * 2018-11-30
- */
- import React, { Component } from 'react';
- import { StyleSheet, TouchableOpacity, View, ScrollView, Image, TextInput, Text, Platform } from 'react-native';
- import LinearGradient from "react-native-linear-gradient";
- import Icon from 'react-native-vector-icons/FontAwesome5';
- import { postReq } from './utils/post'
- import Crypter from './utils/Crypter';
- import base64 from 'react-native-base64';
- import { NativeModules } from 'react-native';
- import { Buffer } from 'buffer';
- import DeviceInfo from 'react-native-device-info';
- import { Dialog, ProgressDialog, ConfirmDialog } from 'react-native-simple-dialogs';
- import Checkbox from 'react-native-modest-checkbox'
- import Toast, { DURATION } from 'react-native-easy-toast'
- import { AsyncStorage } from "react-native"
- import Globals from './utils/Globals'
- import TouchID from 'react-native-touch-id'
- import CryptoJS from 'crypto-js'
- var Aes = NativeModules.Aes;
- var deviceMac;
- var deviceIp;
- var deviceId;
- var retData;
- var logo = require("./assets/head_logo.gif")
- class Login extends Component {
- constructor(props) {
- super(props);
- this.prevUsername = '';
- this.prevMobile = '';
- this.tanCode = '';
- this.sessionToken = '';
- this.isTouchID = false;
- this.fingerPrintState = 0;
- this.prevFingerPrintState = 0;
- this.loginWidth = "70%";
- this.state = {
- progressVisible: false,
- confDialogVisible: false,
- tanDialogVisible: false,
- rememberme: false,
- rememberDev: false,
- confPassDialogVisible: false,
- touchIDsupport: false,
- fingerPrint: false,
- mobileErr: false,
- userErr: false,
- passErr: false
- };
- }
- componentDidMount() {
- // console.log(this.props.screenProps);
- deviceId = this.props.screenProps.deviceId;
- // console.log(deviceId);
- Globals.OTS_URL = this.props.screenProps.otsUrl;
- console.log(Globals.OTS_URL);
- this.getDeviceIp();
- this.getDeviceMac();
- this.retrieveData();
- this.setState({
- progressVisible: true
- })
- TouchID.isSupported()
- .then(biometryType => {
- this.loginWidth = "70%";
- this.setState({ touchIDsupport: true });
- this.setState({
- progressVisible: false
- })
- })
- .catch(error => {
- this.loginWidth = "100%";
- this.setState({ touchIDsupport: false });
- this.setState({
- progressVisible: false
- })
- });
- }
- getDeviceIp = () => {
- DeviceInfo.getIPAddress().then(ip => {
- deviceIp = ip;
- });
- }
- getDeviceMac = () => {
- DeviceInfo.getMACAddress().then(mac => {
- deviceMac = mac;
- });
- }
- generateTraceNo = () => {
- var today = new Date();
- var date = today.getFullYear() + '' + ("0" + (today.getMonth() + 1)).slice(-2) + '' + ("0" + today.getDate()).slice(-2);
- var millis = ("0" + today.getMilliseconds()).slice(-2);
- var time = ("0" + today.getHours()).slice(-2) + "" + ("0" + today.getMinutes()).slice(-2) + "" + ("0" + today.getSeconds()).slice(-2) + "" + millis;
- var dateTime = date + '' + time;
- return dateTime;
- }
- touchIDconfirm() {
- const optionalConfigObject = {
- title: "Нэвтрэх", // Android
- imageColor: "#e00606", // Android
- imageErrorColor: "#ff0000", // Android
- sensorDescription: "Хурууны хээгээ уншуулна уу", // Android
- sensorErrorDescription: "Failed", // Android
- cancelText: "Cancel", // Android
- fallbackLabel: "", // iOS (if empty, then label is hidden)
- unifiedErrors: false, // use unified error messages (default false)
- passcodeFallback: false // iOS
- }
- var promise = TouchID.authenticate('demo', optionalConfigObject)
- .then(success => {
- return 0;
- })
- .catch(error => {
- throw (error);
- });
- return promise;
- }
- login = (fingerPrint) => {
- if (this.state.username === undefined || this.state.username === null || this.state.username.length === 0) {
- // this.refs.toast.show("Хэрэглэгчийн нэрээ оруулна уу", DURATION.LENGTH_LONG);
- this.setState({ userErr: true });
- return;
- }
- if (this.state.phone === undefined || this.state.phone === null || this.state.phone.length !== 8) {
- // this.refs.toast.show("Утасны дугаараа оруулна уу", DURATION.LENGTH_LONG);
- this.setState({ mobileErr: true });
- return;
- }
- if (((this.prevMobile === '' || this.prevMobile !== String(this.state.phone)) || (this.prevUsername === '' || this.prevUsername !== String(this.state.username))) && this.state.fingerPrint === true) {
- this.fingerPrintState = 1;
- this.loginFunc();
- return;
- }
- if (((this.prevMobile === String(this.state.phone)) || (this.prevUsername === String(this.state.username))) && this.state.fingerPrint === true && this.prevFingerPrintState === false) {
- this.fingerPrintState = 1;
- this.loginFunc();
- return;
- }
- if (((this.prevMobile === '' || this.prevMobile === String(this.state.phone)) || (this.prevUsername === '' || this.prevUsername === String(this.state.username))) && this.state.fingerPrint === true && this.prevFingerPrintState === true) {
- if (fingerPrint === true) {
- this.fingerPrintState = 2;
- this.touchIDconfirm().then(value => {
- if (value !== 0) {
- this.setState({
- confMsg: 'Хурууны хээ унших алдаа fingerprintState = 2',
- confDialogVisible: true
- });
- return;
- } else {
- this.loginFunc();
- }
- }).catch(err => {
- console.log(err);
- this.setState({
- confMsg: 'Хурууны хээ унших алдаа fingerprintState = 2, catch',
- confDialogVisible: true
- });
- return;
- });
- }
- else {
- this.fingerPrintState = 3;
- this.loginFunc();
- }
- }
- if (fingerPrint === true) {
- this.setState({
- fingerPrint: true
- });
- }
- if ((this.state.password === undefined || this.state.password === null || this.state.password.length <= 3) && this.fingerPrintState !== 2) {
- if (this.state.password === undefined || this.state.password === null || this.state.password.length !== 6) {
- // this.refs.toast.show("Нууц үгээ оруулна уу", DURATION.LENGTH_LONG);
- this.setState({ passErr: true });
- return;
- } else if (this.state.password === undefined || this.state.password === null || this.state.password.length !== 4) {
- // this.refs.toast.show("Нууц үгээ оруулна уу", DURATION.LENGTH_LONG);
- this.setState({ passErr: true });
- return;
- }
- }
- if (this.fingerPrintState === 0 && fingerPrint === false) {
- this.loginFunc();
- }
- }
- loginFunc = () => {
- this.setState({
- progressVisible: true
- })
- let pin = Crypter.crypt(this.state.phone + '_' + this.state.password) //pin
- let hashpin = Crypter.getHex(Crypter.hash(this.state.phone + '_' + this.state.password)) //hashpin
- let secureData = {};
- let traceno = this.generateTraceNo();
- secureData["srcMsisdn"] = this.state.phone;
- secureData["traceNo"] = '2018121017101111';
- secureData["loginName"] = this.state.username;
- secureData["pin"] = hashpin;
- secureData["pinEnc"] = pin;
- //console.log(secureData);
- let jsonData = JSON.stringify(secureData);
- //console.log(jsonData);
- let sd = this.encrypt1(jsonData, secureData["traceNo"])
- let ek = this.encrypt2(secureData["traceNo"]);
- //console.log(ek);
- this.makeSg(jsonData).then((res) => {
- let sg = base64.encode(this.bin2String(this.hexToBytes(res.cipher)));
- //console.log(sg);
- var sendingData = {};
- sendingData["deviceId"] = deviceId;
- sendingData["fingerPrintFlag"] = this.fingerPrintState;
- sendingData["SD"] = sd;
- sendingData["deviceMac"] = deviceMac;
- sendingData["srcInstId"] = 11;
- sendingData["deviceAppVersion"] = "1.0";
- sendingData["SG"] = sg;
- sendingData["EK"] = ek;
- sendingData["wallet"] = "TESO_BUMM";
- sendingData["sessionType"] = 1;
- sendingData["lang"] = 0;
- sendingData["pushNotifToken"] = "qwehjhvbsf123";
- sendingData["deviceOsVersion"] = DeviceInfo.getSystemVersion();
- sendingData["deviceName"] = DeviceInfo.getDeviceName();
- sendingData["channel"] = 41;
- sendingData["deviceIp"] = deviceIp;
- postReq(sendingData, "1000").then((response) => {
- this.setState({
- progressVisible: false
- })
- this.loginSuccess(response);
- }
- ).catch(function (error) {
- this.setState({
- progressVisible: false
- })
- //console.log(error.message);
- throw error;
- });
- });
- }
- encrypt1 = (text, keyBase64) => {
- // var ivBase64 = "oeLV/tpSCo+KGaq7CtBVrA==";
- // if (Platform.OS === 'ios') {
- // return Aes.encrypt(text, keyBase64, ivBase64).then(cipher => ({ cipher, iv: ivBase64 }));
- // } else {
- var ivBase64 = "oeLV/tpSCo+KGaq7CtBVrA==";
- let keyHex = Buffer(keyBase64).toString('hex');
- let sg = Buffer(base64.decode("a1e2d5feda520a8f8a19aabb0ad055ac")).toString('hex');
- let key64 = base64.encode(keyBase64);
- let key = CryptoJS.enc.Hex.parse(keyHex);
- let iv = CryptoJS.enc.Hex.parse("a1e2d5feda520a8f8a19aabb0ad055ac");
- let test = CryptoJS.AES.encrypt(text, key, { iv: iv }).toString();
- return test;
- // return Aes.encrypt(text, keyHex, "a1e2d5feda520a8f8a19aabb0ad055ac").then(cipher => ({ cipher, iv: ivBase64 }));
- // }
- };
- hexToBytes(hex) {
- for (var bytes = [], c = 0; c < hex.length; c += 2)
- bytes.push(parseInt(hex.substr(c, 2), 16));
- return bytes;
- }
- bin2String(array) {
- return String.fromCharCode.apply(String, array);
- }
- registerBioDevice(enable) {
- secureData["traceNo"] = traceno;
- let jsonData = JSON.stringify(secureData);
- let sd = this.encrypt1(jsonData, secureData["traceNo"]);
- let ek = this.encrypt2(secureData["traceNo"]);
- //console.log(ek);
- return this.makeSg(jsonData).then((res) => {
- let sg = base64.encode(this.bin2String(this.hexToBytes(res.cipher)));
- //console.log(sg);
- var sendingData = {};
- sendingData["deviceId"] = deviceId;
- sendingData["enable"] = enable;
- sendingData["SD"] = sd;
- sendingData["srcInstId"] = 11;
- sendingData["SG"] = sg;
- sendingData["EK"] = ek;
- sendingData["sessionToken"] = retData.sessionToken;
- sendingData["lang"] = 0;
- sendingData["channel"] = 41;
- postReq(sendingData, "1009").then((response) => {
- this.setState({
- progressVisible: false
- })
- if ((response.responseCode === 0 || response.responseCode === "0")) {
- return 0;
- } else {
- return response.responseDesc;
- }
- }
- ).catch(function (error) {
- this.setState({
- progressVisible: false
- })
- //console.log(error.message);
- throw error;
- });
- });
- }
- encrypt2 = (data) => {
- var publicKey = '{' +
- '"n":"9f4193f6cccb90697a493df8f6faa232a5e760ebf44bae052a6b5e718171ced0c7cbcf5b6847b304db5e7de1c62cab450967a1b212e8a9dfc29586f4ce6fc0d8985bc5cebe9c77890b0de32ec87da89b20ca0daa61c4d8c54100dd408e233d2e1eee81441f99429012027d6337538501078fdc2688132dbe4315991ca3c790d1",' +
- '"e":"10001"' +
- '}';
- var RSAKey = require('react-native-rsa');
- var rsa = new RSAKey();
- rsa.setPublicString(publicKey);
- let test = rsa.encrypt(data);
- //console.log('testing');
- //console.log(test);
- //console.log('testing 1')
- var asd = this.hexToBytes(test);
- //console.log(asd)
- //console.log('testing 2')
- //console.log(this.bin2String(asd))
- return base64.encode(this.bin2String(asd));
- }
- makeSg(data) {
- return Aes.sha1(data).then(cipher => ({ cipher }));
- }
- loginSuccess(e) {
- //console.log(e);
- retData = e;
- if (e.responseCode === 0 || e.responseCode === "0") {
- this.prevUsername = this.state.username;
- this.prevMobile = this.state.phone;
- }
- if ((e.responseCode === 0 || e.responseCode === "0") && (e.pinBlock === 0 || e.pinBlock === "0")) {
- if (this.fingerPrintState === 1) {
- this.setState({
- progressVisible: true
- });
- let secureData = {};
- let traceno = this.generateTraceNo();
- secureData["traceNo"] = traceno;
- let jsonData = JSON.stringify(secureData);
- sd = this.encrypt1(jsonData, secureData["traceNo"]);
- let ek = this.encrypt2(secureData["traceNo"]);
- //console.log(ek);
- this.makeSg(jsonData).then((res) => {
- let sg = base64.encode(this.bin2String(this.hexToBytes(res.cipher)));
- //console.log(sg);
- var sendingData = {};
- sendingData["deviceId"] = deviceId;
- sendingData["enable"] = 1;
- sendingData["SD"] = sd;
- sendingData["srcInstId"] = 11;
- sendingData["SG"] = sg;
- sendingData["EK"] = ek;
- sendingData["sessionToken"] = retData.sessionToken;
- sendingData["lang"] = 0;
- sendingData["channel"] = 41;
- postReq(sendingData, "1009").then((response) => {
- this.setState({
- progressVisible: false
- })
- if ((response.responseCode === 0 || response.responseCode === "0")) {
- this.touchIDconfirm().then(value => {
- if (value !== 0) {
- this.setState({
- confMsg: 'Хурууны хээ уншихад алдаа гарлаа',
- confDialogVisible: true
- });
- } else {
- if (this.state.rememberme === true) {
- if (this.state.fingerPrint === true) {
- this.prevFingerPrintState = this.state.fingerPrint;
- this.saveData(this.state.username, this.state.phone, "1", "1");
- } else {
- this.saveData(this.state.username, this.state.phone, "1", "0");
- }
- } else {
- this.saveData("", "", "0", "0");
- }
- this.props.screenProps.callBack(retData);
- }
- }).catch(err => {
- console.log(err);
- this.setState({
- confMsg: 'Хурууны хээ уншихад алдаа catch()',
- confDialogVisible: true
- });
- return;
- });
- } else {
- this.setState({
- confMsg: response.responseDesc,
- confDialogVisible: true
- });
- return;
- }
- }).catch(function (error) {
- this.setState({
- progressVisible: false
- })
- //console.log(error.message);
- throw error;
- });
- });
- } else {
- if (this.state.rememberme === true) {
- if (this.state.fingerPrint === true && (this.fingerPrintState === 2 || this.fingerPrintState === 3)) {
- this.saveData(this.state.username, this.state.phone, "1", "1");
- } else {
- this.saveData(this.state.username, this.state.phone, "1", "0");
- }
- } else {
- this.saveData("", "", "0", "0");
- }
- this.props.screenProps.callBack(retData);
- }
- // this.props.navigation.pop();
- // this.setState({
- // confMsg: 'SUCCESS',
- // confDialogVisible: true
- // });
- } else if (e.pinBlock === 1 || e.pinBlock === "1") {
- this.setState({
- confMsg: 'Таны ПИН түгжигдсэн байна',
- confDialogVisible: true
- });
- } else if (e.responseCode === "12200127" || e.responseCode === 12200127) {
- this.setState({
- tanDialogVisible: true
- });
- } else if (e.pinBlock === 2 || e.pinBlock === "2" || e.pinBlock === 3 || e.pinBlock === "3") {
- this.sessionToken = e.sessionToken;
- this.changePass();
- } else if (e.pinBlock === 4 || e.pinBlock === "4" || e.pinBlock === 4 || e.pinBlock === "4") {
- }
- else {
- this.setState({
- confMsg: e.responseDesc,
- confDialogVisible: true
- });
- }
- }
- confirmTan = () => {
- this.setState({
- progressVisible: true
- })
- var secureData = {};
- var traceno = this.generateTraceNo();
- secureData["srcMsisdn"] = this.state.phone;
- secureData["traceNo"] = traceno;
- secureData["tan"] = this.tanCode;
- //console.log(secureData);
- let jsonData = JSON.stringify(secureData);
- //console.log(jsonData);
- let sd = this.encrypt1(jsonData, secureData["traceNo"])
- let ek = this.encrypt2(secureData["traceNo"]);
- //console.log(ek);
- this.makeSg(jsonData).then((res) => {
- let sg = base64.encode(this.bin2String(this.hexToBytes(res.cipher)));
- //console.log(sg);
- var sendingData = {};
- sendingData["SD"] = sd;
- if (this.state.rememberDev === true) {
- sendingData["deviceId"] = deviceId;
- } else {
- sendingData["deviceId"] = "";
- }
- sendingData["EK"] = ek;
- sendingData["SG"] = sg;
- sendingData["channel"] = 41;
- sendingData["lang"] = 0;
- sendingData["srcInstId"] = 11;
- postReq(sendingData, "5088").then((response) => {
- this.setState({
- progressVisible: false
- })
- this.tanSuccess(response);
- }
- ).catch(function (error) {
- this.setState({
- progressVisible: false
- })
- //console.log(error.message);
- throw error;
- });
- });
- }
- tanSuccess(res) {
- //console.log(res);
- if (res.responseCode === 0 || res.responseCode === "0") {
- this.setState({ tanDialogVisible: false })
- this.login();
- } else {
- this.setState({
- confMsg: res.responseDesc,
- confDialogVisible: true
- })
- }
- }
- rememberme() {
- if (this.state.rememberme === false) {
- this.setState({
- rememberme: true
- });
- } else {
- this.setState({
- fingerPrint: false,
- rememberme: false
- });
- }
- }
- rememberDev() {
- if (this.state.rememberDev === false) {
- this.setState({
- rememberDev: true
- });
- } else {
- this.setState({
- rememberDev: false
- });
- }
- }
- passChangeCallback = (e) => {
- if (this.state.rememberme === true) {
- this.saveData(this.state.username, this.state.phone, "1");
- } else {
- this.saveData("", "", "0");
- }
- // this.setState({
- // confMsg: 'SUCCESS',
- // confDialogVisible: true
- // });
- this.props.screenProps.callBack(retData);
- }
- changePass = () => {
- //console.log("entered");
- this.setState({
- confMsg: 'Та нууц үгээ солих шаардлагатай',
- confPassDialogVisible: true
- });
- this.props.navigation.navigate('ChangePass', {
- mobile: this.state.phone,
- sessionToken: this.sessionToken,
- onGoBack: (item) => this.passChangeCallback(item),
- });
- }
- saveData = (username, mobile, rememberMe, biometric) => {
- AsyncStorage.setItem("username", username);
- AsyncStorage.setItem("mobile", mobile);
- AsyncStorage.setItem("remember", rememberMe);
- AsyncStorage.setItem("biometric", biometric);
- }
- retrieveData = () => {
- AsyncStorage.getItem("username").then((value) => {
- this.setState({ username: value });
- this.prevUsername = value;
- }).done();
- AsyncStorage.getItem("mobile").then((value) => {
- this.setState({ phone: value });
- this.prevMobile = value;
- }).done();
- AsyncStorage.getItem("remember").then((value) => {
- //console.log(value);
- if (value === 1 || value === "1") {
- this.setState({ rememberme: true });
- } else {
- this.setState({ rememberme: false });
- }
- }).done();
- AsyncStorage.getItem("biometric").then((value) => {
- //console.log(value);
- if (value === 1 || value === "1") {
- this.setState({ fingerPrint: true });
- this.prevFingerPrintState = true;
- } else {
- this.setState({ fingerPrint: false });
- this.prevFingerPrintState = false;
- }
- }).done();
- }
- rememberBio() {
- if (this.state.fingerPrint === false) {
- this.setState({
- fingerPrint: true,
- rememberme: true
- });
- } else {
- this.setState({
- fingerPrint: false
- });
- }
- }
- render() {
- return (
- <LinearGradient
- style={styles.container}
- start={{ x: 1, y: 0 }}
- end={{ x: 0, y: 0.7 }}
- colors={['#F16A45', '#D45037', '#F0563C']}>
- <Dialog
- visible={this.state.tanDialogVisible}
- title="Тан код"
- onTouchOutside={() => this.setState({ tanDialogVisible: false })} >
- <View style={{ flexDirection: "column" }}>
- <Text>
- Та уг гар утаснаас анх удаа хандаж байгаа тул имэйлээр ирсэн ТАН кодыг оруулж баталгаажуулна уу
- </Text>
- <TextInput
- placeholder="Тан код"
- placeholderTextColor="rgba(0,0,0,0.5)"
- selectionColor="#000"
- keyboardType='numeric'
- onChangeText={(tanCode) => this.tanCode = tanCode}
- underlineColorAndroid="transparent"
- />
- <Checkbox
- checked={this.state.rememberDev}
- label='Байнга хандах төхөөрөмж'
- onChange={(checked) => this.rememberDev()}
- />
- <View style={{ flexDirection: "row", justifyContent: 'flex-end' }}>
- <TouchableOpacity onPress={this.confirmTan.bind(this)}>
- <Text>
- Баталгаажуулах
- </Text>
- </TouchableOpacity>
- </View>
- </View>
- </Dialog>
- <ConfirmDialog
- message={this.state.confMsg}
- visible={this.state.confPassDialogVisible}
- onTouchOutside={() => this.setState({ confPassDialogVisible: false })}
- positiveButton={{
- title: "Ok",
- onPress: () => {
- this.setState({ confPassDialogVisible: false })
- }
- }}
- />
- <ConfirmDialog
- message={this.state.confMsg}
- visible={this.state.confDialogVisible}
- onTouchOutside={() => this.setState({ confDialogVisible: false })}
- positiveButton={{
- title: "Ok",
- onPress: () => { this.setState({ confDialogVisible: false }) }
- }}
- />
- <ProgressDialog
- visible={this.state.progressVisible}
- message="Please, wait..."
- />
- <ScrollView>
- <View style={styles.header}>
- <Image
- style={{
- width: 180,
- height: 60,
- }}
- source={logo}
- />
- </View>
- <View style={styles.box}>
- <View style={styles.inputCont}>
- <View style={{ marginBottom: 20 }}>
- <TextInput
- placeholder="Хэрэглэгчийн нэр"
- placeholderTextColor="rgba(255,255,255,0.5)"
- selectionColor="#fff"
- style={styles.input}
- value={this.state.username}
- onChangeText={(username) => this.setState({ username, userErr: false })}
- underlineColorAndroid="transparent"
- />
- <View style={{ height: 10 }}>
- {this.state.userErr &&
- <Text
- style={styles.loginErr}>
- Хэрэглэгчийн нэр оруулна уу
- </Text>
- }
- </View>
- <TextInput
- placeholder="Утасны дугаар"
- placeholderTextColor="rgba(255,255,255,0.5)"
- selectionColor="#fff"
- keyboardType='numeric'
- maxLength={8}
- style={styles.input}
- value={this.state.phone}
- onChangeText={(phone) => this.setState({ phone, mobileErr: false })}
- underlineColorAndroid="transparent"
- />
- <Text
- style={styles.loginErr}>
- Утасны дугаар оруулна уу
- </Text>
- <TextInput
- placeholder="Нууц үгээ оруулна уу"
- placeholderTextColor="rgba(255,255,255,0.5)"
- selectionColor="#fff"
- style={styles.input}
- value={this.password}
- maxLength={6}
- secureTextEntry={true}
- keyboardType='numeric'
- onChangeText={(password) => this.setState({ password })}
- underlineColorAndroid="transparent"
- />
- <Text style={styles.loginErr}>
- Нууц үг оруулна уу
- </Text>
- </View>
- <View style={{ flexDirection: "column", marginBottom: 20 }}>
- <Checkbox
- checked={this.state.rememberme}
- checkboxStyle={{ tintColor: "#fff" }}
- labelStyle={styles.loginCheckBox}
- label='Намайг сана'
- onChange={(checked) => this.rememberme()}
- />
- <Checkbox
- checked={this.state.fingerPrint}
- checkboxStyle={{ tintColor: "#fff" }}
- labelStyle={styles.loginCheckBox}
- label='Хурууны хээгээр нэвтрэх'
- onChange={(checked) => this.rememberBio()}
- />
- </View>
- <View style={{ flexDirection: "row" }}>
- <View style={{ width: this.loginWidth, height: 48 }}>
- <TouchableOpacity
- style={styles.login}
- onPress={() => this.login(false)}>
- <Text>
- Нэвтрэх
- </Text>
- </TouchableOpacity>
- </View>
- {this.state.touchIDsupport &&
- <View style={{ width: "30%" }}>
- <TouchableOpacity style={styles.finger}
- onPress={() => this.login(true)}
- >
- <Icon
- name="fingerprint"
- size={35}
- />
- </TouchableOpacity>
- </View>
- }
- </View>
- </View>
- </View>
- <Toast ref="toast" position='bottom' />
- </ScrollView>
- </LinearGradient>
- );
- }
- }
- var styles = StyleSheet.create({
- container: {
- flex: 1,
- backgroundColor: "rgb(44,189,165)"
- },
- header: {
- flex: 1,
- marginTop: 80,
- marginBottom: 80,
- justifyContent: "center",
- alignItems: "center",
- },
- box: {
- height: 450,
- },
- input: {
- borderBottomColor: "#fff",
- borderBottomWidth: 0.3,
- color: "#fff",
- fontSize: 16,
- height: 40
- },
- loginErr: {
- color: "#f4f441",
- fontSize: 10,
- textAlign: 'right',
- alignSelf: 'stretch'
- },
- inputCont: {
- paddingLeft: 50,
- paddingRight: 50
- },
- loadingCont: {
- flex: 1,
- },
- pass: {
- flexDirection: "row",
- flex: 1,
- marginTop: 15,
- justifyContent: "space-around"
- },
- row: {
- flexDirection: "row"
- },
- icon: {
- color: "#fff",
- paddingRight: 6
- },
- login: {
- backgroundColor: "#FF6F00",
- justifyContent: "center",
- alignItems: "center",
- height: 48
- },
- finger: {
- height: 48,
- backgroundColor: "#fff",
- justifyContent: "center",
- alignItems: "center",
- },
- loginCheckBox: {
- color: "#fff"
- }
- });
- export default Login;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement