File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,20 @@ export default class SettingsView extends React.Component {
6565 }
6666 }
6767
68- logIn = async ( ) => {
68+ logIn = ( ) => {
6969 this . props . navigator . push ( {
7070 id : 'SISLoginView' ,
7171 index : this . props . route . index + 1 ,
7272 } )
7373 }
7474
75+ logOut = async ( ) => {
76+ // this.props.navigator.push({
77+ // id: 'SISLoginView',
78+ // index: this.props.route.index + 1,
79+ // })
80+ }
81+
7582 focusUsername = ( ) => {
7683 console . log ( this . _usernameInput )
7784 this . _usernameInput . focus ( )
@@ -109,7 +116,7 @@ export default class SettingsView extends React.Component {
109116 let loggedIn = this . state . success
110117 let loading = this . state . loading
111118
112- let disabled = loading || ( ! username || ! password )
119+ let disabled = loading
113120
114121 let loginTextStyle = disabled
115122 ? styles . loginButtonTextDisabled
Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ import {
99 View ,
1010 Text ,
1111} from 'react-native'
12-
12+ import startsWith from 'lodash/startsWith'
1313
1414import CookieManager from 'react-native-cookies'
1515import LoadingView from '../components/loading'
1616
1717const HOME_URL = 'https://www.stolaf.edu/sis/index.cfm'
18- const LOGIN_URL = 'https://www.stolaf.edu/sis/landing-page.cfm'
18+ const LOGIN_URL = 'https://www.stolaf.edu/sis/login.cfm'
19+ const AUTH_REJECTED_URL = 'https://www.stolaf.edu/sis/login.cfm?error=access_denied#'
1920
2021
2122export default class SISLoginView extends React . Component {
@@ -24,6 +25,10 @@ export default class SISLoginView extends React.Component {
2425 cookieLoaded : false ,
2526 }
2627
28+ componentWillMount ( ) {
29+ this . loadCookie ( )
30+ }
31+
2732 loadCookie = ( ) => {
2833 CookieManager . get ( HOME_URL , cookie => {
2934 let isAuthenticated
@@ -57,10 +62,12 @@ export default class SISLoginView extends React.Component {
5762 onNavigationStateChange = navState => {
5863 // If we get redirected back to the HOME_URL we know that we are logged in. If your backend does something different than this
5964 // change this line.
60- if ( navState . url == HOME_URL ) {
65+ if ( startsWith ( navState . url , HOME_URL ) ) {
6166 this . setState ( {
6267 loggedIn : true ,
6368 } )
69+ } else if ( startsWith ( navState . url , AUTH_REJECTED_URL ) ) {
70+ this . navigator . pop ( )
6471 }
6572 }
6673
You can’t perform that action at this time.
0 commit comments