diff --git a/app/assets/styles/blink/_Logo.scss b/app/assets/styles/blink/_Logo.scss index 1a13ae7..de5140b 100644 --- a/app/assets/styles/blink/_Logo.scss +++ b/app/assets/styles/blink/_Logo.scss @@ -1,18 +1,9 @@ -.title { - padding: 5px; - margin: 0 auto; - color: white; - font-size: 36px; -} - .logoContainer { - margin:0 auto; + padding: 15px; + padding-top: 35px; } .logo { - width: 120px; - height: 120px; - resize-mode: contain; - margin-top: 10px; - margin-bottom: 20px; + width: 150px; + height: 150px; } diff --git a/app/assets/styles/blink/_RegisterBox.scss b/app/assets/styles/blink/_RegisterBox.scss index 6ecf2f5..6fb76b4 100644 --- a/app/assets/styles/blink/_RegisterBox.scss +++ b/app/assets/styles/blink/_RegisterBox.scss @@ -1,9 +1,13 @@ -.registerBox { +.landscapeRegisterBox { flex: 1; - padding: 50px; - width: 100%; + flex-direction: row; + justify-content: space-evenly; + align-items: center; } -.title { - color: white; +.portraitRegisterBox { + flex: 1; + flex-direction: column; + justify-content: flex-start; + align-items: center; } diff --git a/app/assets/styles/blink/_RegisterForm.scss b/app/assets/styles/blink/_RegisterForm.scss index 6f58e38..ad1063e 100644 --- a/app/assets/styles/blink/_RegisterForm.scss +++ b/app/assets/styles/blink/_RegisterForm.scss @@ -1,30 +1,53 @@ -.container { +.landscapeContainer { + display: flex; + flex: 1; + flex-direction: column; + margin: 0 auto; + justify-content: center; +} + +.portaitContainer { flex: 1; flex-direction: column; margin: 0 auto; } .title { + padding: 15px; + margin: 0 auto; + color: white; + font-size: 36px; +} + +.subtitle { margin: 0 auto; color: white; margin-bottom: 10px; font-size: 18px; } .row { padding: 0px 0; width: 300; + margin: 0 auto; +} + +.buttonRow { + flex-direction: row; + width: 300; + margin: 0 auto; } .button { margin-top: 30px; - border-radius: 20px; - width: 200; + border-radius: 1px; + border: 1px; + width: 150; margin: 0 auto; margin-top: 30px; } .input { border-radius: 0px; } diff --git a/app/components/Logo.js b/app/components/Logo.js index 377dd3f..27f1f85 100644 --- a/app/components/Logo.js +++ b/app/components/Logo.js @@ -1,20 +1,17 @@ import React, { Fragment } from 'react'; import { View, Image } from 'react-native'; import { Title } from 'react-native-paper'; import styles from '../assets/styles/blink/_Logo.scss'; const blinkLogo = require('../assets/images/blink-white-big.png'); const Logo = () => { return ( - - Sylk - ); } export default Logo; diff --git a/app/components/RegisterBox.js b/app/components/RegisterBox.js index 8f291af..3266f90 100644 --- a/app/components/RegisterBox.js +++ b/app/components/RegisterBox.js @@ -1,28 +1,37 @@ import React from 'react'; import { View } from 'react-native'; import PropTypes from 'prop-types'; import RegisterForm from './RegisterForm'; import Logo from './Logo'; import styles from '../assets/styles/blink/_RegisterBox.scss'; + const RegisterBox = (props) => { + const containerClass = props.orientation === 'landscape' ? styles.landscapeRegisterBox : styles.portraitRegisterBox; + return ( - - + + + + + + ); }; RegisterBox.propTypes = { handleRegistration : PropTypes.func.isRequired, registrationInProgress : PropTypes.bool, - autoLogin : PropTypes.bool + autoLogin : PropTypes.bool, + orientation : PropTypes.string }; export default RegisterBox; diff --git a/app/components/RegisterForm.js b/app/components/RegisterForm.js index 2c51702..2fa1490 100644 --- a/app/components/RegisterForm.js +++ b/app/components/RegisterForm.js @@ -1,149 +1,158 @@ import React, { Component } from 'react'; import { View, Keyboard } from 'react-native'; import PropTypes from 'prop-types'; import ipaddr from 'ipaddr.js'; import autoBind from 'auto-bind'; -import { Button, TextInput, Title } from 'react-native-paper'; +import { Button, TextInput, Title, Subheading } from 'react-native-paper'; import EnrollmentModal from './EnrollmentModal'; import storage from '../storage'; import config from '../config'; import styles from '../assets/styles/blink/_RegisterForm.scss'; class RegisterForm extends Component { constructor(props) { super(props); autoBind(this); this.state = { accountId: '', password: '', registering: false, remember: false, showEnrollmentModal: false }; } componentDidMount() { storage.get('account').then((account) => { if (account) { this.setState(Object.assign({}, account, {remember: true})); if (this.props.autoLogin && this.state.password !== '') { this.props.handleRegistration(this.state.accountId, this.state.password); } } }); } handleAccountIdChange(value) { this.setState({accountId: value}); } handlePasswordChange(value) { this.setState({password: value}); } handleSubmit(event) { if (event) { event.preventDefault(); } + + let account = this.state.accountId; + if (this.state.accountId.indexOf('@') === -1 ) { + account = this.state.accountId + '@' + config.defaultDomain; + } + Keyboard.dismiss(); - this.props.handleRegistration(this.state.accountId, this.state.password, true); + this.props.handleRegistration(account, this.state.password, true); } handleEnrollment(account) { this.setState({showEnrollmentModal: false}); if (account !== null) { this.setState({accountId: account.accountId, password: account.password, registering: true}); this.props.handleRegistration(account.accountId, account.password); } } createAccount(event) { event.preventDefault(); this.setState({showEnrollmentModal: true}); } render() { - const domain = this.state.accountId.substring(this.state.accountId.indexOf('@') + 1); - const validDomain = !ipaddr.IPv4.isValidFourPartDecimal(domain) && !ipaddr.IPv6.isValid(domain); - const validInput = validDomain && this.state.accountId.indexOf('@') !== -1 && this.state.password !== 0; + const domain = this.state.accountId.indexOf('@') !== -1 ? this.state.accountId.substring(this.state.accountId.indexOf('@') + 1): ''; + const validDomain = domain === '' || (!ipaddr.IPv4.isValidFourPartDecimal(domain) && !ipaddr.IPv6.isValid(domain) && domain.length > 3 && domain.indexOf('.') !== - 1 && (domain.length - 2 - domain.indexOf('.')) > 0); + const validInput = validDomain && this.state.password !== ''; + const containerClass = this.props.orientation === 'landscape' ? styles.landscapeContainer : styles.portraitContainer; return ( - - Sign in to continue + + Sylk + Sign in to continue this.passwordInput.focus()} /> { this.passwordInput = ref; }} /> - + { config.enrollmentUrl ? : null } ); } } RegisterForm.propTypes = { classes : PropTypes.object, handleRegistration : PropTypes.func.isRequired, registrationInProgress : PropTypes.bool.isRequired, - autoLogin : PropTypes.bool + autoLogin : PropTypes.bool, + orientation : PropTypes.string }; export default RegisterForm;