Skip to content

Commit

Permalink
Fix token regex, use scroll view for login by token view
Browse files Browse the repository at this point in the history
  • Loading branch information
terrysahaidak committed Jun 28, 2017
1 parent b88dfc4 commit a00d5aa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion app/modules/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {setItem, removeItem} from '../utils/storage'
* Constants
*/

const TOKEN_REGEX = /^[a-z][a-z\d]*$/i
const TOKEN_REGEX = /^[a-z\d]*$/i

export const LOGINING = 'auth/LOGINING'
export const LOGINED_IN_SUCCESS = 'auth/LOGINED_IN_SUCCESS'
Expand Down
2 changes: 1 addition & 1 deletion app/screens/Login/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const styles = StyleSheet.create({
},
buttonStyle: {
backgroundColor: 'white',
marginBottom: 20,
marginBottom: 16,
height: 35,
borderRadius: 2,
justifyContent: 'center',
Expand Down
60 changes: 31 additions & 29 deletions app/screens/LoginByToken/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import {TextInput, Text, View, Linking} from 'react-native';
import {TextInput, Text, View, Linking, ScrollView} from 'react-native';
import s from './styles'
import {connect} from 'react-redux'
import {checkToken} from '../../modules/auth'
Expand Down Expand Up @@ -65,35 +65,37 @@ class LoginByTokenScreen extends Component {
const {logining, errors, error} = this.props
return (
<View style={s.container}>
<View style={s.textfieldContainer}>
<TextInput
disableFullscreenUI
autoCorrect={false}
spellCheck={false}
value={this.state.token}
placeholder="Paste token here..."
placeholderTextColor={colors.raspberry}
style={s.textfield}
underlineColorAndroid="white"
onChange={this.handleChangeText} />
</View>
{error && <Text style={s.error}>{errors}</Text>}
<View style={s.hintContainer}>
<Text style={s.hint}>
To get your authentication token press "Get token" button. It will open developer.gitter.im site in your browser.{'\n'}{'\n'}After signing in you will see caption "Personal Access Token". Below that caption will be your access token.{'\n'}{'\n'}Copy it and paste inside text input. Then press check mark.
</Text>
</View>
<View style={s.buttonContainer}>
<Button
rippleColor={colors.raspberry}
style={[s.buttonStyle, {backgroundColor: colors.raspberry}]}
onPress={() => Linking.openURL('https://developer.gitter.im/login')}>
<Text pointerEvents="none"
style={s.buttonText}>
Get token
<ScrollView>
<View style={s.textfieldContainer}>
<TextInput
disableFullscreenUI
autoCorrect={false}
spellCheck={false}
value={this.state.token}
placeholder="Paste token here..."
placeholderTextColor={colors.raspberry}
style={s.textfield}
underlineColorAndroid="white"
onChange={this.handleChangeText} />
</View>
{error && <Text style={s.error}>{errors}</Text>}
<View style={s.hintContainer}>
<Text style={s.hint}>
To get your authentication token press "Get token" button. It will open developer.gitter.im site in your browser.{'\n'}{'\n'}After signing in you will see caption "Personal Access Token". Below that caption will be your access token.{'\n'}{'\n'}Copy it and paste inside text input. Then press check mark.
</Text>
</Button>
</View>
</View>
<View style={s.buttonContainer}>
<Button
rippleColor={colors.raspberry}
style={[s.buttonStyle, {backgroundColor: colors.raspberry}]}
onPress={() => Linking.openURL('https://developer.gitter.im/login')}>
<Text pointerEvents="none"
style={s.buttonText}>
Get token
</Text>
</Button>
</View>
</ScrollView>

{logining && this.renderLoading()}
</View>
Expand Down

0 comments on commit a00d5aa

Please sign in to comment.