From 593e8de4c8e15d61fbe19611d34195fc1b6ccefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Mih=C3=A1ly?= Date: Thu, 6 Apr 2017 08:17:39 +0200 Subject: [PATCH] fix rm unintentieonaly staged file --- src/core/components/auth/oauth2.jsx.orig | 218 ----------------------- 1 file changed, 218 deletions(-) delete mode 100644 src/core/components/auth/oauth2.jsx.orig diff --git a/src/core/components/auth/oauth2.jsx.orig b/src/core/components/auth/oauth2.jsx.orig deleted file mode 100644 index 48fe946e..00000000 --- a/src/core/components/auth/oauth2.jsx.orig +++ /dev/null @@ -1,218 +0,0 @@ -import React, { PropTypes } from "react" -import oauth2Authorize from "core/oauth2-authorize" - -const IMPLICIT = "implicit" -const ACCESS_CODE = "accessCode" -const PASSWORD = "password" -const APPLICATION = "application" - -export default class Oauth2 extends React.Component { - static propTypes = { - name: PropTypes.string, - authorized: PropTypes.object, - getComponent: PropTypes.func.isRequired, - schema: PropTypes.object.isRequired, - authSelectors: PropTypes.object.isRequired, - authActions: PropTypes.object.isRequired, - errSelectors: PropTypes.object.isRequired, - errActions: PropTypes.object.isRequired, - getConfigs: PropTypes.any - } - - constructor(props, context) { - super(props, context) - let { name, schema, authorized } = this.props - let auth = authorized && authorized.get(name) - let username = auth && auth.get("username") || "" - let clientId = auth && auth.get("clientId") || "" - let clientSecret = auth && auth.get("clientSecret") || "" - let passwordType = auth && auth.get("passwordType") || "none" - - this.state = { - name: name, - schema: schema, - scopes: [], - clientId: clientId, - clientSecret: clientSecret, - username: username, - password: "", - passwordType: passwordType - } - } - - authorize =() => { - let { authActions, errActions, getConfigs } = this.props - let configs = getConfigs() - - errActions.clear({authId: name,type: "auth", source: "auth"}) - oauth2Authorize(this.state, authActions, errActions, configs) - } - - onScopeChange =(e) => { - let { target } = e - let { checked } = target - let scope = target.dataset.value - - if ( checked && this.state.scopes.indexOf(scope) === -1 ) { - let newScopes = this.state.scopes.concat([scope]) - this.setState({ scopes: newScopes }) - } else if ( !checked && this.state.scopes.indexOf(scope) > -1) { - this.setState({ scopes: this.state.scopes.filter((val) => val !== scope) }) - } - } - - onInputChange =(e) => { - let { target : { dataset : { name }, value } } = e - let state = { - [name]: value - } - - this.setState(state) - } - - logout =(e) => { - e.preventDefault() - let { authActions, errActions, name } = this.props - - errActions.clear({authId: name, type: "auth", source: "auth"}) - authActions.logout([ name ]) - } - - render() { - let { schema, getComponent, authSelectors, errSelectors, name } = this.props - const Input = getComponent("Input") - const Row = getComponent("Row") - const Col = getComponent("Col") - const Button = getComponent("Button") - const AuthError = getComponent("authError") - const JumpToPath = getComponent("JumpToPath", true) - const Markdown = getComponent( "Markdown" ) - - let flow = schema.get("flow") - let scopes = schema.get("allowedScopes") || schema.get("scopes") - let authorizedAuth = authSelectors.authorized().get(name) - let isAuthorized = !!authorizedAuth - let errors = errSelectors.allErrors().filter( err => err.get("authId") === name) - let isValid = !errors.filter( err => err.get("source") === "validation").size - - return ( -
-

OAuth2.0

- - - { isAuthorized &&
Authorized
} - - { ( flow === IMPLICIT || flow === ACCESS_CODE ) &&

Authorization URL: { schema.get("authorizationUrl") }

} - { ( flow === PASSWORD || flow === ACCESS_CODE || flow === APPLICATION ) &&

Token URL: { schema.get("tokenUrl") }

} -

Flow: { schema.get("flow") }

- - { - flow === PASSWORD && ( !isAuthorized || isAuthorized && this.state.username) && - username: - - { - isAuthorized ? { this.state.username } - : - } - - - } - - { - flow === PASSWORD && !isAuthorized && - password: - - - - - } - - { - flow === PASSWORD && - type: - - { - isAuthorized ? { this.state.passwordType } - : - } - - - } - - { - ( flow === IMPLICIT || flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) && - ( !isAuthorized || isAuthorized && this.state.clientId) && - - - { - isAuthorized ? { this.state.clientId } - : - } - - - } - - { - ( flow === ACCESS_CODE || ( flow === PASSWORD && this.state.passwordType!== "none") ) && - - - { - isAuthorized ? { this.state.clientSecret } - : - } - - - } - - { - !isAuthorized && scopes && scopes.size ?
-

Scopes:

- { scopes.map((description, name) => { - return ( - -
- - -
-
- ) - }).toArray() - } -
: null - } - - { - errors.valueSeq().map( (error, key) => { - return - } ) - } -
- { isValid && flow !== APPLICATION && - ( isAuthorized ? - : - ) - } -
- -
- ) - } -}