mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
Fixed Dependencies & Core Optimization
This commit is contained in:
parent
2320d880eb
commit
ed38aa12f2
@ -3,6 +3,6 @@ const path = require('path')
|
||||
const lessToJs = require('less-vars-to-js')
|
||||
|
||||
module.exports = () => {
|
||||
const themePath = path.join(__dirname, '../src/themes/default.less')
|
||||
const themePath = path.join(__dirname, '../src/themes/vars.less')
|
||||
return lessToJs(fs.readFileSync(themePath, 'utf8'))
|
||||
}
|
||||
|
110
package.json
110
package.json
@ -1,36 +1,29 @@
|
||||
{
|
||||
"name": "comty-development",
|
||||
"version": "0.1.10",
|
||||
"version": "0.1.13",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"author": "RageStudio",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@ant-design/pro-layout": "^4.9.11",
|
||||
"@lingui/react": "^2.9.0",
|
||||
"@ant-design/pro-layout": "^4.10.13",
|
||||
"@lingui/react": "^2.9.1",
|
||||
"ant-design-pro": "^2.3.2",
|
||||
"antd": "^3.26.3",
|
||||
"autoprefixer": "7.1.6",
|
||||
"axios": "^0.18.0",
|
||||
"antd": "^3.26.9",
|
||||
"autoprefixer": "9.7.4",
|
||||
"axios": "^0.19.2",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"body-parser": "^1.19.0",
|
||||
"chart.js": "^2.9.3",
|
||||
"classnames": "^2.2.6",
|
||||
"concurrently": "^5.0.2",
|
||||
"cryptr": "^4.0.2",
|
||||
"dns": "^0.2.2",
|
||||
"concurrently": "^5.1.0",
|
||||
"cryptr": "^6.0.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"draftjs-to-html": "^0.8.4",
|
||||
"draftjs-to-markdown": "^0.5.1",
|
||||
"dva-model-extend": "^0.1.2",
|
||||
"enquire-js": "^0.2.1",
|
||||
"highcharts-exporting": "^0.1.7",
|
||||
"highcharts-more": "^0.1.7",
|
||||
"immutability-helper": "^3.0.1",
|
||||
"is-empty": "^1.2.0",
|
||||
"jquery": "^3.4.1",
|
||||
"js-cookie": "^2.2.1",
|
||||
"json-format": "^1.0.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"lodash": "^4.17.15",
|
||||
@ -40,84 +33,65 @@
|
||||
"nprogress": "^0.2.0",
|
||||
"os-utils": "0.0.14",
|
||||
"passport": "^0.4.1",
|
||||
"passport-auth0": "^1.3.1",
|
||||
"passport-auth0": "^1.3.2",
|
||||
"passport-jwt": "^4.0.0",
|
||||
"path-to-regexp": "^2.4.0",
|
||||
"prop-types": "^15.7.0",
|
||||
"qs": "^6.9.0",
|
||||
"path-to-regexp": "^6.1.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"qs": "^6.9.1",
|
||||
"radium": "^0.26.0",
|
||||
"rc-tween-one": "^2.6.8",
|
||||
"react-animations": "^1.0.0",
|
||||
"react-bootstrap": "^0.32.4",
|
||||
"react-chartjs": "^1.2.0",
|
||||
"react-chat-elements": "^10.1.1",
|
||||
"react-countup": "^4.3.0",
|
||||
"react-dazzle": "^1.4.0",
|
||||
"react-detect-offline": "^2.4.0",
|
||||
"react-draft-wysiwyg": "^1.14.1",
|
||||
"react-fullscreen-crossbrowser": "^1.0.9",
|
||||
"react-helmet": "^5.2.0",
|
||||
"react-highcharts": "^16.1.0",
|
||||
"react-helmet": "^5.2.1",
|
||||
"react-iframe": "^1.8.0",
|
||||
"react-modal": "^3.11.1",
|
||||
"react-new-window": "^0.1.2",
|
||||
"react-notifications": "^1.4.3",
|
||||
"react-perfect-scrollbar": "^1.4.2",
|
||||
"react-plyr": "^2.2.0",
|
||||
"react-responsive": "^8.0.1",
|
||||
"react-perfect-scrollbar": "^1.5.8",
|
||||
"react-responsive": "^8.0.3",
|
||||
"react-router": "^5.1.2",
|
||||
"react-scripts": "2.1.1",
|
||||
"react-select-country-list": "^2.0.1",
|
||||
"react-server-status": "^1.1.1",
|
||||
"react-scripts": "^3.3.1",
|
||||
"react-select-country-list": "^2.1.2",
|
||||
"react-sound": "^1.2.0",
|
||||
"recompose": "^0.30.0",
|
||||
"simple-oauth2": "^3.1.0",
|
||||
"socket.io-client": "^2.1.1",
|
||||
"store": "^2.0.12",
|
||||
"stripe": "^7.14.0",
|
||||
"ts-cookies": "^1.0.0",
|
||||
"uifx": "^1.0.8",
|
||||
"umi-plugin-datahub": "^3.2.1",
|
||||
"universal-cookie": "^4.0.2",
|
||||
"validator": "^12.1.0",
|
||||
"websocket": "^1.0.31"
|
||||
"umi-plugin-datahub": "^4.1.0",
|
||||
"validator": "^12.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron-builder": "^20.43.0",
|
||||
"electron-devtools-installer": "^2.2.4",
|
||||
"electron-reload": "^1.4.0",
|
||||
"rimraf": "^2.6.3",
|
||||
"wait-on": "^3.2.0",
|
||||
"@lingui/babel-preset-react": "^2.9.0",
|
||||
"@lingui/cli": "^2.9.0",
|
||||
"@lingui/loader": "^2.9.0",
|
||||
"@types/react": "^16.9.16",
|
||||
"rimraf": "^3.0.2",
|
||||
"wait-on": "^4.0.0",
|
||||
"@lingui/babel-preset-react": "^2.9.1",
|
||||
"@lingui/cli": "^2.9.1",
|
||||
"@lingui/loader": "^2.9.1",
|
||||
"@types/react": "^16.9.19",
|
||||
"babel-eslint": "^10.0.3",
|
||||
"babel-plugin-dev-expression": "^0.2.2",
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"babel-plugin-macros": "^2.8.0",
|
||||
"babel-plugin-module-resolver": "^3.2.0",
|
||||
"cross-env": "^5.2.1",
|
||||
"electron": "^7.1.8",
|
||||
"eslint": "^5.15.0",
|
||||
"eslint-config-react-app": "^3.0.5",
|
||||
"eslint-plugin-flowtype": "^3.13.0",
|
||||
"eslint-plugin-import": "^2.19.1",
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"cross-env": "^7.0.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-react-app": "^5.2.0",
|
||||
"eslint-plugin-flowtype": "^4.6.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||
"eslint-plugin-react": "^7.17.0",
|
||||
"husky": "^1.3.0",
|
||||
"eslint-plugin-react": "^7.18.3",
|
||||
"husky": "^4.2.3",
|
||||
"less-vars-to-js": "^1.3.0",
|
||||
"lint-staged": "^8.1.0",
|
||||
"lint-staged": "^10.0.7",
|
||||
"mockjs": "^1.1.0",
|
||||
"module": "^1.2.5",
|
||||
"now": "^16.7.0",
|
||||
"prettier": "^1.16.0",
|
||||
"stylelint": "^9.10.0",
|
||||
"stylelint-config-prettier": "^5.3.0",
|
||||
"stylelint-config-standard": "^18.2.0",
|
||||
"typescript": "^3.7.3",
|
||||
"umi": "^2.12.7",
|
||||
"umi-plugin-react": "^1.14.10"
|
||||
"now": "^17.0.3",
|
||||
"prettier": "^1.19.1",
|
||||
"stylelint": "^13.1.0",
|
||||
"stylelint-config-prettier": "^8.0.1",
|
||||
"stylelint-config-standard": "^20.0.0",
|
||||
"typescript": "^3.7.5",
|
||||
"umi": "^2.13.3",
|
||||
"umi-plugin-react": "^1.15.2"
|
||||
},
|
||||
"lingui": {
|
||||
"fallbackLocale": "en",
|
||||
|
@ -168,7 +168,7 @@ export function ValidLoginSession(){
|
||||
}
|
||||
if (SDCPContainer) {
|
||||
try {
|
||||
let SDCPContainerDC = atob(SDCPContainer)
|
||||
atob(SDCPContainer)
|
||||
ValidSDCP = true
|
||||
} catch (error) {
|
||||
return
|
||||
@ -337,14 +337,12 @@ export function GetUserData (values, customPayload, callback) {
|
||||
let resParsed = JSON.parse(resString);
|
||||
DevOptions.ShowFunctionsLogs ? console.log(prefix, 'Fechted user data...' ) : null
|
||||
callback( resParsed )
|
||||
return resParsed
|
||||
}
|
||||
)
|
||||
.fail(
|
||||
function (response) {
|
||||
DevOptions.ShowFunctionsLogs ? console.log(prefix, 'Server failure!', response) : null
|
||||
callback( null )
|
||||
return
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Dropdown, Button, Icon, Menu } from 'antd'
|
||||
|
||||
const DropOption = ({
|
||||
onMenuClick,
|
||||
menuOptions = [],
|
||||
buttonStyle,
|
||||
dropdownProps,
|
||||
}) => {
|
||||
const menu = menuOptions.map(item => (
|
||||
<Menu.Item key={item.key}>{item.name}</Menu.Item>
|
||||
))
|
||||
return (
|
||||
<Dropdown overlay= {
|
||||
<Menu onClick={onMenuClick}>{menu}</Menu>
|
||||
} {...dropdownProps}>
|
||||
|
||||
<Button style={{ border: 'none', ...buttonStyle }}>
|
||||
<Icon style={{ marginRight: 2 }} type="bars" />
|
||||
<Icon type="down" />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
)
|
||||
}
|
||||
|
||||
DropOption.propTypes = {
|
||||
onMenuClick: PropTypes.func,
|
||||
menuOptions: PropTypes.array.isRequired,
|
||||
buttonStyle: PropTypes.object,
|
||||
dropdownProps: PropTypes.object,
|
||||
}
|
||||
|
||||
export default DropOption
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "DropOption",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "./DropOption.js"
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Editor } from 'react-draft-wysiwyg';
|
||||
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
|
||||
import styles from './Editor.less';
|
||||
|
||||
const DraftEditor = props => {
|
||||
return (
|
||||
<Editor
|
||||
toolbarClassName={ styles.toolbar }
|
||||
wrapperClassName={ styles.wrapper }
|
||||
editorClassName={ styles.editor }
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default DraftEditor
|
@ -1,106 +0,0 @@
|
||||
.wrapper {
|
||||
height: 500px;
|
||||
|
||||
:global {
|
||||
.rdw-dropdownoption-default {
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.rdw-dropdown-optionwrapper {
|
||||
box-sizing: content-box;
|
||||
width: 100%;
|
||||
border-radius: 0 0 2px 2px;
|
||||
&:hover {
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
.rdw-inline-wrapper {
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0;
|
||||
|
||||
.rdw-option-wrapper {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.rdw-option-active {
|
||||
box-shadow: 1px 1px 0 #e8e8e8 inset;
|
||||
}
|
||||
|
||||
.rdw-colorpicker-option {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.rdw-colorpicker-modal,
|
||||
.rdw-embedded-modal,
|
||||
.rdw-emoji-modal,
|
||||
.rdw-image-modal,
|
||||
.rdw-link-modal {
|
||||
box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.rdw-colorpicker-modal,
|
||||
.rdw-embedded-modal,
|
||||
.rdw-link-modal {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.rdw-emoji-modal {
|
||||
width: 214px;
|
||||
}
|
||||
|
||||
.rdw-colorpicker-modal {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.rdw-embedded-modal-btn,
|
||||
.rdw-image-modal-btn,
|
||||
.rdw-link-modal-btn {
|
||||
height: 32px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.rdw-embedded-modal-input,
|
||||
.rdw-embedded-modal-size-input,
|
||||
.rdw-link-modal-input {
|
||||
padding: 2px 6px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.rdw-dropdown-selectedtext {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.rdw-dropdown-wrapper,
|
||||
.rdw-option-wrapper {
|
||||
min-width: 36px;
|
||||
transition: all 0.2s ease;
|
||||
height: 30px;
|
||||
|
||||
&:active {
|
||||
box-shadow: 1px 1px 0 #e8e8e8 inset;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
box-shadow: 1px 1px 0 #e8e8e8;
|
||||
}
|
||||
}
|
||||
|
||||
.rdw-dropdown-wrapper {
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
.rdw-editor-main {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.editor {
|
||||
border: 1px solid #f1f1f1;
|
||||
padding: 5px;
|
||||
border-radius: 2px;
|
||||
height: auto;
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "Editor",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "./Editor.js"
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styles from './FilterItem.less';
|
||||
|
||||
const FilterItem = ({ label = '', children }) => {
|
||||
const labelArray = label.split('')
|
||||
return (
|
||||
<div className={ styles.filterItem }>
|
||||
{
|
||||
labelArray.length > 0 ? (
|
||||
<div className={ styles.labelWrap }>
|
||||
{labelArray.map((item, index) => (
|
||||
<span className="labelText" key={ index }>
|
||||
{ item }
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
) : ('')
|
||||
}
|
||||
<div className={ styles.item }>{ children }</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
FilterItem.propTypes = {
|
||||
label: PropTypes.string,
|
||||
children: PropTypes.element.isRequired,
|
||||
}
|
||||
|
||||
export default FilterItem
|
@ -1,17 +0,0 @@
|
||||
.filterItem {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.labelWrap {
|
||||
width: 64px;
|
||||
line-height: 28px;
|
||||
margin-right: 12px;
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "FilterItem",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"main": "./FilterItem.js"
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
@import '~themes/vars.less';
|
||||
.ControlCard{
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
width: auto;
|
||||
|
@ -1,3 +1,4 @@
|
||||
@import '~themes/vars.less';
|
||||
.loader {
|
||||
background-color: rgba(255, 255, 255, 0.945);
|
||||
width: 100%;
|
||||
|
@ -1,3 +1,4 @@
|
||||
@import '~themes/vars.less';
|
||||
.cardWrapper{
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
border-radius: 7px;
|
||||
|
@ -1,3 +1,4 @@
|
||||
@import '~themes/vars.less';
|
||||
.cardWrapper{
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
border-radius: 7px;
|
||||
|
@ -1,3 +1,4 @@
|
||||
@import '~themes/vars.less';
|
||||
:global {
|
||||
.ps--active-x > .ps__rail-x,
|
||||
.ps--active-y > .ps__rail-y {
|
||||
|
@ -1,4 +1,4 @@
|
||||
@import '~themes/default';
|
||||
@import '~themes/vars.less';
|
||||
|
||||
.UserCover {
|
||||
position: relative;
|
||||
|
@ -1,3 +1,5 @@
|
||||
@import '~themes/vars.less';
|
||||
|
||||
.inputform {
|
||||
:global{
|
||||
input {
|
||||
|
@ -1,357 +0,0 @@
|
||||
//****************************************|
|
||||
//**** Yulio ID v1.6 *****|
|
||||
//****************************************|
|
||||
//
|
||||
// @ Licensed by RageStudio(c) 2019
|
||||
// @ Build 03102019EU21700 F/WIAPIS
|
||||
// @ https://api.ragestudio.net/RS-YIBTP
|
||||
//
|
||||
//****************************************|
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'dva'
|
||||
import { Button, Row, Form, Input, Drawer, Icon, Collapse, Select, Checkbox, Result, Layout, message, notification } from 'antd'
|
||||
import { Trans, withI18n } from '@lingui/react'
|
||||
import { setLocale } from 'utils'
|
||||
import { UIFxPY, UIFxList, DevOptions } from 'ycore';
|
||||
import { endpoints } from 'ycore';
|
||||
import $ from 'jquery';
|
||||
import styles from './yid.scss';
|
||||
import {resetToken} from './ycore_sdcp.js'
|
||||
|
||||
import Cookies from 'universal-cookie';
|
||||
import Cryptr from 'cryptr';
|
||||
|
||||
const cookies = new Cookies();
|
||||
|
||||
const FormItem = Form.Item
|
||||
|
||||
@withI18n()
|
||||
@connect(({ loading }) => ({ loading }))
|
||||
@Form.create()
|
||||
class YulioIDForms extends PureComponent {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = {
|
||||
// Drawers Visibility (Default on False)
|
||||
MainLoginVisible: false,
|
||||
NOTFdrawer: false,
|
||||
SOTFdrawer: false,
|
||||
RGSOTFdrawer: false,
|
||||
registerVisible: false,
|
||||
ForggotPasswordVisible: false,
|
||||
// Arrays
|
||||
ErrorType: '',
|
||||
FailArray: '',
|
||||
username: '',
|
||||
password: '',
|
||||
server_key: '',
|
||||
access_token: '',
|
||||
user_data: [],
|
||||
ExceptionID: '',
|
||||
EXCPMS: '',
|
||||
CompleteFORM: '',
|
||||
TSDCP: '',
|
||||
user_id: '',
|
||||
api_response: {},
|
||||
api_response_ud: [],
|
||||
RGUsername: '',
|
||||
RGEmail: '',
|
||||
RGPassword: '',
|
||||
RGGender: '',
|
||||
}
|
||||
this.initRegister = this.initRegister.bind(this);
|
||||
this.initFPassword = this.initFPassword.bind(this);
|
||||
this.cancelRegister = this.cancelRegister.bind(this);
|
||||
this.cancelRecoverPassword = this.cancelRecoverPassword.bind(this);
|
||||
this.closeNOTF = this.closeNOTF.bind(this);
|
||||
this.closeSOTF = this.closeSOTF.bind(this);
|
||||
this.closeRGSOTF = this.closeSOTF.bind(this);
|
||||
|
||||
}
|
||||
// Handlers & others
|
||||
handleUsername(text) {
|
||||
this.setState({ username: text.target.value })
|
||||
}
|
||||
handlePassword(text) {
|
||||
this.setState({ password: text.target.value })
|
||||
}
|
||||
handleRGUsername(text) {
|
||||
this.setState({ RGUsername: text.target.value })
|
||||
}
|
||||
handleRGPassword(text) {
|
||||
this.setState({ RGPassword: text.target.value })
|
||||
}
|
||||
handleRGEmail(text) {
|
||||
this.setState({ RGEmail: text.target.value })
|
||||
}
|
||||
handleRGGender(Ivalue) {
|
||||
this.setState({ RGGender: Ivalue })
|
||||
}
|
||||
handleFPEmail(Ivalue) {
|
||||
this.setState({ FGEmail: Ivalue })
|
||||
}
|
||||
|
||||
|
||||
triggerNOTF() {
|
||||
this.setState({ NOTFdrawer: true });
|
||||
}
|
||||
closeNOTF() {
|
||||
this.setState({ NOTFdrawer: false });
|
||||
}
|
||||
|
||||
triggerSOTF() {
|
||||
this.setState({ SOTFdrawer: true });
|
||||
}
|
||||
closeSOTF() {
|
||||
this.setState({ SOTFdrawer: false });
|
||||
}
|
||||
|
||||
triggerRGSOTF() {
|
||||
this.setState({ RGSOTFdrawer: true });
|
||||
}
|
||||
closeRGSOTF() {
|
||||
this.setState({ RGSOTFdrawer: false });
|
||||
}
|
||||
|
||||
cancelRegister() {
|
||||
this.setState({ registerVisible: false })
|
||||
}
|
||||
cancelRecoverPassword(){
|
||||
this.setState({ ForggotPasswordVisible: false })
|
||||
}
|
||||
|
||||
initRegister() {
|
||||
var messageListener = message.loading('Initialising YulioID ', 1.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisableRegister == false) {
|
||||
this.setState({ registerVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Cannot connect to YulioID Services (Disabled Register)', 2.5))
|
||||
}
|
||||
}
|
||||
|
||||
initFPassword() {
|
||||
var messageListener = message.loading('Initialising YulioID ', 1.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisablePasswordRecover == false) {
|
||||
this.setState({ ForggotPasswordVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Cannot connect to YulioID Services (Disabled Password Recovery)', 2.5))
|
||||
}
|
||||
}
|
||||
ValidateSession() {
|
||||
if (DevOptions.DisableLogin == false) {
|
||||
this.setState({ MainLoginVisible: true })
|
||||
}
|
||||
else {
|
||||
message.error('Error trying to connect to YulioID services', 2.5)
|
||||
$("#ErrorNotification").css({ display: 'block' })
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// INIT
|
||||
this.setState({ server_key: endpoints.server_key });
|
||||
this.ValidateSession();
|
||||
|
||||
const istoken = localStorage.getItem('access_token');
|
||||
const isdone = this.state.CompleteFORM;
|
||||
const getSDCP = localStorage.getItem('SDCP');
|
||||
const availableToken = cookies.get('access_token')
|
||||
if (availableToken) {
|
||||
resetToken()
|
||||
}
|
||||
|
||||
if (isdone == 'true') {
|
||||
setTimeout(() => { location.reload() }, 3000);
|
||||
}
|
||||
if (!getSDCP) {
|
||||
localStorage.setItem('GetNewData', true);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const { loading, form, i18n } = this.props
|
||||
const MensageException = this.state.EXCPMS;
|
||||
const ExceptionID = this.state.ExceptionID;
|
||||
const { Panel } = Collapse;
|
||||
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* LOGIN SECTION */}
|
||||
<Drawer width={520} closable={false} visible={this.state.MainLoginVisible}>
|
||||
|
||||
<main className={styles.mainlp}>
|
||||
<section className={styles.forms}>
|
||||
|
||||
<h6 className={styles.h6lp}>YulioID™</h6>
|
||||
<h1 className={styles.h1lp}>Welcome Back !</h1>
|
||||
<form className={styles.formlogin}>
|
||||
|
||||
<div className={styles.input__wrapper}>
|
||||
|
||||
<label className={styles.labelform}><Icon type="user" style={{ fontSize: '15px' }} /> Username</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('Username', { rules: [{ required: true }] })(
|
||||
<input className={styles.inputform} type="text" placeholder="Username" onChange={(text) => { this.handleUsername(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<div className={styles.input__wrapper}>
|
||||
<label className={styles.labelform}><Icon type="unlock" style={{ fontSize: '15px' }} /> Password</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('Password', { rules: [{ required: true }] })(
|
||||
<input className={styles.inputform} type="password" placeholder="Password (At least 8 characters)" onChange={(text) => { this.handlePassword(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<div style={{ margin: 'auto' }}><a className={styles.buttonlp} id="login" onClick={this.getAuth}>Login</a></div>
|
||||
<h2 style={{ textAlign: 'center', margin: '8px', color: '#666' }}>Or</h2>
|
||||
<div style={{ float: 'left' }}><Button type="dashed" onClick={this.initFPassword} style={{ top: '8px' }}><Icon type="exclamation-circle" /> Forgotten password</Button></div>
|
||||
<div style={{ float: 'right' }}><Button type="dashed" onClick={this.initRegister} style={{ top: '8px' }}><Icon type="user-add" /> Create an account</Button></div>
|
||||
|
||||
<div className={styles.spinner__wrapper} id="loadingspn">
|
||||
<div><Icon type="loading" style={{ fontSize: 24, margin: '13px' }} spin /></div>
|
||||
<div>
|
||||
<br /><br /><br />
|
||||
<div style={{ margin: 'auto' }}><h6 className={styles.h6lp} style={{ textAlign: 'center', marginTop: '15%' }}>Wait a sec...</h6></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
</Drawer>
|
||||
|
||||
{/* REGISTER SECTION */}
|
||||
<Drawer width={680} closable={true} onClose={this.cancelRegister} visible={this.state.registerVisible}>
|
||||
<main className={styles.mainlp}>
|
||||
<section className={styles.forms}>
|
||||
<h6 className={styles.h6lp}>YulioID™</h6>
|
||||
<h1 className={styles.h1lp}>Register</h1>
|
||||
<h3>Wow congratulations, very soon you will begin to discover rStudio, but first you will have to start by filling out this form</h3>
|
||||
<form className={styles.formlogin}>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
<label className={styles.labelform}> Choose your Username</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('rgUsername', { rules: [{ required: true }] })(
|
||||
<Input type="text" prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Username" onChange={(text) => { this.handleRGUsername(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
<label className={styles.labelform}> Fill with your email</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('rgEmail', { rules: [{ required: true }] })(
|
||||
<Input type="text" prefix={<Icon type="link" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Email" onChange={(text) => { this.handleRGEmail(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
<label className={styles.labelform}> Fill with your password</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('rgPassword', { rules: [{ required: true }] })(
|
||||
<Input type="password" prefix={<Icon type="key" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Password" onChange={(text) => { this.handleRGPassword(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
</div>
|
||||
<div className={styles.TOSAccept}><span><span style={{ color: 'red', fontSize: '17px' }}>*</span> Clicking the register button you accept our <a href="#">terms and conditions</a></span> </div>
|
||||
<a className={styles.buttonlp} id="register" onClick={this.getRegister}>Register</a>
|
||||
<div className={styles.spinner__wrapper} id="loadingRGspn">
|
||||
<div style={{ position: 'absolute', marginLeft: '86%', marginTop: '-65%' }}><Icon type="loading" style={{ fontSize: 24 }} spin /></div>
|
||||
<div>
|
||||
<div><Icon style={{ fontSize: '160px', margin: '30px', color: '#5B2A86' }} type="smile" /></div>
|
||||
<h6 className={styles.h6lp} style={{ textAlign: 'center' }}>Ok thanks, wait a minute...</h6>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</Drawer>
|
||||
|
||||
{/* FORGOTTEN PASSWORD SECTION */}
|
||||
<Drawer width={420} closable={true} onClose={this.cancelRecoverPassword} visible={this.state.ForggotPasswordVisible}>
|
||||
<main className={styles.mainlp}>
|
||||
<section className={styles.forms}>
|
||||
<h6 className={styles.h6lp}>YulioID™</h6>
|
||||
<h1 className={styles.h1lp}>Forgotten Password!</h1>
|
||||
<h3>To recover your account enter the email used to register</h3>
|
||||
<form className={styles.formlogin}>
|
||||
<div className={styles.input__wrapper}>
|
||||
<label className={styles.labelform}><Icon type="mail" style={{ fontSize: '15px' }} /> Email</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('Email', { rules: [{ required: true }] })(
|
||||
<input className={styles.inputform} type="text" placeholder="myaccount@example.com" onChange={(text) => { this.handleFPEmail(text) }} /> )}
|
||||
</FormItem>
|
||||
</div>
|
||||
{/* <div style={{ margin: 'auto' }}><a className={styles.buttonlp} id="login" onClick={this.RecoverPassword(this.state.FGEmail)}>Recover</a></div> */}
|
||||
<div className={styles.spinner__wrapper} id="loadingspn">
|
||||
<div><Icon type="loading" style={{ fontSize: 24, margin: '13px' }} spin /></div>
|
||||
<div>
|
||||
<br /><br /><br />
|
||||
<div style={{ margin: 'auto' }}><h6 className={styles.h6lp} style={{ textAlign: 'center', marginTop: '15%' }}>Wait a sec...</h6></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</Drawer>
|
||||
|
||||
{/* NOTF */}
|
||||
<Drawer width={320} closable={false} visible={this.state.NOTFdrawer} >
|
||||
<div style={{ textAlign: 'center', color: 'orange' }} ><Icon type="warning" style={{ fontSize: '230px' }} />
|
||||
<h2 className={styles.h2lp}> {this.state.FailArray} </h2>
|
||||
<h4 className={styles.apierrort}> {MensageException} </h4> <hr />
|
||||
<div id="details-collapse" style={{ textAlign: 'center' }}>
|
||||
<Collapse bordered={false} defaultActiveKey={['0']} expandIcon={({ isActive }) => <Icon type="caret-right" rotate={isActive ? 90 : 0} />}>
|
||||
<Panel header="Details" key="1" style={{ borderRadius: 4, marginBottom: 24, border: 0, overflow: 'hidden', }}>
|
||||
<Icon type="exception" />
|
||||
<h6>STATUS HANDLER => {this.state.ErrorType} </h6>
|
||||
<h6>EXCEPTION => {this.state.api_response} </h6>
|
||||
<h6>EXCEPTION MENSAGE => {MensageException}</h6>
|
||||
<h6><strong>ID {ExceptionID}</strong></h6>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
<hr /><Button type="danger" onClick={this.closeNOTF}>TRY AGAIN</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Drawer>
|
||||
|
||||
|
||||
{/* SOTF */}
|
||||
<Drawer width={320} closable={false} visible={this.state.SOTFdrawer}>
|
||||
<div style={{ textAlign: 'center', color: '#4BB543' }} ><Icon type="check" style={{ fontSize: '200px' }} />
|
||||
<h2 className={styles.h2lp} style={{ color: '#4BB543' }} > Success </h2>
|
||||
<h4>Please wait while process your data ...</h4>
|
||||
</div>
|
||||
</Drawer>
|
||||
{/* RGSOTF */}
|
||||
<Drawer width={320} closable={false} visible={this.state.RGSOTFdrawer}>
|
||||
<div style={{ textAlign: 'center', color: 'green' }} >
|
||||
<Icon type="check" style={{ fontSize: '200px' }} />
|
||||
<h2 className={styles.h2lp} style={{ color: 'green' }} > Registered </h2>
|
||||
<h4 className={styles.apierrort}> Welcome to Dashboard, you will start discovering now</h4>
|
||||
<h4>Please check your new data while we are process you ...</h4>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
YulioIDForms.propTypes = {
|
||||
form: PropTypes.object,
|
||||
dispatch: PropTypes.func,
|
||||
loading: PropTypes.object,
|
||||
}
|
||||
|
||||
export default YulioIDForms
|
@ -1,551 +0,0 @@
|
||||
//****************************************|
|
||||
//**** Yulio ID v1.6 *****|
|
||||
//****************************************|
|
||||
//
|
||||
// @ Licensed by RageStudio(c) 2019
|
||||
// @ Build 03102019EU21700 F/WIAPIS
|
||||
// @ https://api.ragestudio.net/RS-YIBTP
|
||||
//
|
||||
//****************************************|
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'dva'
|
||||
import { Button, Row, Form, Input, Drawer, Icon, Collapse, Select, Checkbox, Result, Layout, message, notification } from 'antd'
|
||||
import { Trans, withI18n } from '@lingui/react'
|
||||
import { setLocale } from 'utils'
|
||||
import { UIFxPY, UIFxList, DevOptions } from 'ycore';
|
||||
import { endpoints } from 'ycore';
|
||||
import $ from 'jquery';
|
||||
import styles from './yid.scss';
|
||||
import './ycore_sdcp';
|
||||
import YIDForms from './forms.js'
|
||||
|
||||
// import {getUserData, getUserRGData, getRegister, getAuth, resetToken, processError, processSuccess, processRGSuccess, processJSON, processRGJSON} from './loginFunctions.js';
|
||||
|
||||
import Cookies from 'universal-cookie';
|
||||
import Cryptr from 'cryptr';
|
||||
|
||||
const cookies = new Cookies();
|
||||
|
||||
const FormItem = Form.Item
|
||||
|
||||
@withI18n()
|
||||
@connect(({ loading }) => ({ loading }))
|
||||
@Form.create()
|
||||
class YulioID extends PureComponent {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = {
|
||||
// Drawers Visibility (Default on False)
|
||||
MainLoginVisible: false,
|
||||
NOTFdrawer: false,
|
||||
SOTFdrawer: false,
|
||||
RGSOTFdrawer: false,
|
||||
registerVisible: false,
|
||||
ForggotPasswordVisible: false,
|
||||
// Arrays
|
||||
ErrorType: '',
|
||||
FailArray: '',
|
||||
username: '',
|
||||
password: '',
|
||||
server_key: '',
|
||||
access_token: '',
|
||||
user_data: [],
|
||||
ExceptionID: '',
|
||||
EXCPMS: '',
|
||||
CompleteFORM: '',
|
||||
TSDCP: '',
|
||||
user_id: '',
|
||||
api_response: {},
|
||||
api_response_ud: [],
|
||||
RGUsername: '',
|
||||
RGEmail: '',
|
||||
RGPassword: '',
|
||||
RGGender: '',
|
||||
}
|
||||
this.getAuth = this.getAuth.bind(this);
|
||||
this.getRegister = this.getRegister.bind(this);
|
||||
this.getUserData = this.getUserData.bind(this);
|
||||
this.initRegister = this.initRegister.bind(this);
|
||||
this.initFPassword = this.initFPassword.bind(this);
|
||||
this.cancelRegister = this.cancelRegister.bind(this);
|
||||
this.cancelRecoverPassword = this.cancelRecoverPassword.bind(this);
|
||||
this.closeNOTF = this.closeNOTF.bind(this);
|
||||
this.closeSOTF = this.closeSOTF.bind(this);
|
||||
this.closeRGSOTF = this.closeSOTF.bind(this);
|
||||
this.processSuccess = this.processSuccess.bind(this);
|
||||
this.processRGSuccess = this.processSuccess.bind(this);
|
||||
this.processJSON = this.processJSON.bind(this);
|
||||
this.processRGJSON = this.processJSON.bind(this);
|
||||
}
|
||||
// Handlers & others
|
||||
handleUsername(text) {
|
||||
this.setState({ username: text.target.value })
|
||||
}
|
||||
handlePassword(text) {
|
||||
this.setState({ password: text.target.value })
|
||||
}
|
||||
handleRGUsername(text) {
|
||||
this.setState({ RGUsername: text.target.value })
|
||||
}
|
||||
handleRGPassword(text) {
|
||||
this.setState({ RGPassword: text.target.value })
|
||||
}
|
||||
handleRGEmail(text) {
|
||||
this.setState({ RGEmail: text.target.value })
|
||||
}
|
||||
handleRGGender(Ivalue) {
|
||||
this.setState({ RGGender: Ivalue })
|
||||
}
|
||||
handleFPEmail(Ivalue) {
|
||||
this.setState({ FGEmail: Ivalue })
|
||||
}
|
||||
|
||||
|
||||
triggerNOTF() {
|
||||
this.setState({ NOTFdrawer: true });
|
||||
}
|
||||
closeNOTF() {
|
||||
this.setState({ NOTFdrawer: false });
|
||||
}
|
||||
|
||||
triggerSOTF() {
|
||||
this.setState({ SOTFdrawer: true });
|
||||
}
|
||||
closeSOTF() {
|
||||
this.setState({ SOTFdrawer: false });
|
||||
}
|
||||
|
||||
triggerRGSOTF() {
|
||||
this.setState({ RGSOTFdrawer: true });
|
||||
}
|
||||
closeRGSOTF() {
|
||||
this.setState({ RGSOTFdrawer: false });
|
||||
}
|
||||
|
||||
cancelRegister() {
|
||||
this.setState({ registerVisible: false })
|
||||
}
|
||||
cancelRecoverPassword(){
|
||||
this.setState({ ForggotPasswordVisible: false })
|
||||
}
|
||||
|
||||
initRegister() {
|
||||
var messageListener = message.loading('Initialising YulioID ', 1.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisableRegister == false) {
|
||||
this.setState({ registerVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Cannot connect to YulioID Services (Disabled Register)', 2.5))
|
||||
}
|
||||
}
|
||||
|
||||
initFPassword() {
|
||||
var messageListener = message.loading('Initialising YulioID ', 1.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisablePasswordRecover == false) {
|
||||
this.setState({ ForggotPasswordVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Cannot connect to YulioID Services (Disabled Password Recovery)', 2.5))
|
||||
}
|
||||
}
|
||||
ValidateSession() {
|
||||
if (DevOptions.DisableLogin == false) {
|
||||
this.setState({ MainLoginVisible: true })
|
||||
}
|
||||
else {
|
||||
message.error('Error trying to connect to YulioID services', 2.5)
|
||||
$("#ErrorNotification").css({ display: 'block' })
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// INIT
|
||||
this.setState({ server_key: endpoints.server_key });
|
||||
this.ValidateSession();
|
||||
|
||||
const istoken = localStorage.getItem('access_token');
|
||||
const isdone = this.state.CompleteFORM;
|
||||
const getSDCP = localStorage.getItem('SDCP');
|
||||
const availableToken = cookies.get('access_token')
|
||||
if (availableToken) {
|
||||
this.resetToken()
|
||||
}
|
||||
|
||||
if (isdone == 'true') {
|
||||
setTimeout(() => { location.reload() }, 3000);
|
||||
}
|
||||
if (!getSDCP) {
|
||||
localStorage.setItem('GetNewData', true);
|
||||
}
|
||||
}
|
||||
|
||||
resetToken() {
|
||||
let _this = this;
|
||||
const tojb1 = endpoints.removeToken;
|
||||
const tobj2 = cookies.get('access_token')
|
||||
let urlOBJ = `${tojb1}${tobj2}`;
|
||||
UIFxPY(UIFxList.notifyWarning)
|
||||
var form = new FormData();
|
||||
form.append("server_key", endpoints.server_key);
|
||||
|
||||
|
||||
var settings = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form
|
||||
};
|
||||
$.ajax(settings).done(function (response) {
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'For continue your request, is necessary to login with YulioID™ again',
|
||||
description:
|
||||
'LoginBridge™ report a access token expiration, and is required you for continue login again with security reasons.',
|
||||
icon: <Icon type="login" style={{ color: '#108ee9' }} />,
|
||||
});
|
||||
cookies.remove('access_token', { path: '/' })
|
||||
});
|
||||
}
|
||||
getUserData() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const IdFromLRApi = JSON.parse(nonProccesContainer)['user_id'];
|
||||
const getStoragedToken = JSON.parse(nonProccesContainer)['access_token'];
|
||||
|
||||
var form2 = new FormData();
|
||||
form2.append("server_key", endpoints.server_key);
|
||||
form2.append("fetch", "user_data,email,username,avatar");
|
||||
form2.append("user_id", IdFromLRApi);
|
||||
|
||||
let _this = this;
|
||||
const yCore_GUDEP = endpoints.get_userData_endpoint;
|
||||
let urlOBJ = `${yCore_GUDEP}${getStoragedToken}`;
|
||||
|
||||
var settings2 = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form2
|
||||
};
|
||||
$.ajax(settings2)
|
||||
.done(function (response2) {
|
||||
_this.setState({ api_response_ud: response2 }),
|
||||
_this.processSuccess();
|
||||
})
|
||||
}
|
||||
getUserRGData() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const IdFromLRApi = JSON.parse(nonProccesContainer)['user_id'];
|
||||
const getStoragedToken = JSON.parse(nonProccesContainer)['access_token'];
|
||||
|
||||
var form2 = new FormData();
|
||||
form2.append("server_key", endpoints.server_key);
|
||||
form2.append("fetch", "user_data,email,username,avatar");
|
||||
form2.append("user_id", IdFromLRApi);
|
||||
|
||||
let _this = this;
|
||||
const yCore_GUDEP = endpoints.get_userData_endpoint;
|
||||
let urlOBJ = `${yCore_GUDEP}${getStoragedToken}`;
|
||||
|
||||
var settings2 = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form2
|
||||
};
|
||||
|
||||
$.ajax(settings2)
|
||||
.done(function (response2) {
|
||||
_this.setState({ api_response_ud: response2 }),
|
||||
_this.processRGSuccess();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
getRegister() {
|
||||
$("#loadingRGspn").css({ opacity: 1, "z-index": 5 });
|
||||
const username = this.state.RGUsername;
|
||||
const password = this.state.RGPassword;
|
||||
const email = this.state.RGEmail;
|
||||
const confirm_password = this.state.RGPassword;
|
||||
const server_key = this.state.server_key;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("server_key", server_key);
|
||||
form.append("username", username);
|
||||
form.append("email", email);
|
||||
form.append("password", password);
|
||||
form.append("confirm_password", confirm_password);
|
||||
|
||||
var settings = {
|
||||
"url": endpoints.register_endpoint,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form,
|
||||
};
|
||||
|
||||
let _this = this;
|
||||
$.ajax(settings)
|
||||
.done(function (response) {
|
||||
_this.setState({ api_response: response }),
|
||||
_this.processRGJSON();
|
||||
})
|
||||
.fail(function (response) {
|
||||
|
||||
_this.setState({
|
||||
FailArray: 'Server Failure',
|
||||
ErrorType: '1',
|
||||
api_response: 'Cannot catch response, Error 500',
|
||||
ExceptionID: '500',
|
||||
EXCPMS: 'Cannot catch response, Error 500',
|
||||
|
||||
}),
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 }),
|
||||
_this.triggerNOTF();
|
||||
})
|
||||
}
|
||||
|
||||
RecoverPassword(inputIO){
|
||||
const cookies = new Cookies();
|
||||
let _this = this;
|
||||
const tojb1 = endpoints.resetPassword_endpoint;
|
||||
const tobj2 = cookies.get('access_token')
|
||||
let urlOBJ = `${tojb1}${tobj2}`;
|
||||
UIFxPY(UIFxList.notifyWarning)
|
||||
var form = new FormData();
|
||||
form.append("server_key", endpoints.server_key);
|
||||
form.append("email", inputIO);
|
||||
|
||||
var settings = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form
|
||||
};
|
||||
$.ajax(settings).done(function (response) {
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'The instructions to recover your account have been sent to the email',
|
||||
description:
|
||||
'If you cant find the email, try looking for it in the spam folder or try again',
|
||||
icon: <Icon type="mail" style={{ color: '#108ee9' }} />,
|
||||
});
|
||||
console.log(response)
|
||||
});
|
||||
}
|
||||
|
||||
getAuth() {
|
||||
$("#loadingspn").css({ opacity: 1, "z-index": 5 });
|
||||
const username = this.state.username;
|
||||
const password = this.state.password;
|
||||
const server_key = this.state.server_key;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("server_key", server_key);
|
||||
form.append("username", username);
|
||||
form.append("password", password);
|
||||
var settings = {
|
||||
"url": endpoints.auth_endpoint,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form,
|
||||
};
|
||||
|
||||
let _this = this;
|
||||
$.ajax(settings)
|
||||
.done(function (response) {
|
||||
_this.setState({ api_response: response }),
|
||||
_this.processJSON();
|
||||
})
|
||||
.fail(function (response) {
|
||||
|
||||
_this.setState({
|
||||
FailArray: 'Server Failure',
|
||||
ErrorType: '1',
|
||||
api_response: 'Cannot catch response, Error 500',
|
||||
ExceptionID: '500',
|
||||
EXCPMS: 'Cannot catch response, Error 500',
|
||||
|
||||
}),
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'Currently our servers are having operating problems',
|
||||
description: 'Please be patient until the services become available again, try again later. We apologize for the inconveniences',
|
||||
icon: <Icon type="login" style={{ color: '#ff0f2f' }} />
|
||||
}),
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 }),
|
||||
_this.triggerNOTF();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
processError() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer)['api_status'];
|
||||
const ExceptionMensage = JSON.parse(this.state.api_response)['errors'];
|
||||
const ExcepID = ExceptionMensage.error_id;
|
||||
const ExceptionMensagePRC = ExceptionMensage.error_text;
|
||||
|
||||
if (stringParsed == '400') {
|
||||
this.triggerNOTF();
|
||||
this.setState({ FailArray: 'Bad credentials' });
|
||||
this.setState({
|
||||
ErrorType: stringParsed,
|
||||
ExceptionID: ExcepID
|
||||
});
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 });
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 });
|
||||
this.setState({ EXCPMS: ExceptionMensagePRC });
|
||||
}
|
||||
if (stringParsed == '404') {
|
||||
this.triggerNOTF();
|
||||
this.setState({ ErrorType: stringParsed });
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 });
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 });
|
||||
this.setState({ EXCPMS: ExceptionMensagePRC });
|
||||
}
|
||||
}
|
||||
|
||||
processSuccess() {
|
||||
// CREATE SDCP PACKAGE
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const accessTokesParsed = JSON.parse(this.state.api_response)['access_token'];
|
||||
const userDataParsed = JSON.parse(this.state.api_response_ud)['user_data'];
|
||||
this.setState({ user_data: userDataParsed });
|
||||
const proccessForParse = JSON.stringify(this.state.user_data);
|
||||
const icryptr = new Cryptr(accessTokesParsed);
|
||||
const encryptedString = icryptr.encrypt(proccessForParse);
|
||||
|
||||
this.setState({ access_token: accessTokesParsed, TSDCP: encryptedString });
|
||||
|
||||
cookies.set('access_token', accessTokesParsed, { path: '/' });
|
||||
cookies.set('last_api_response', nonProccesContainer, { path: '/' });
|
||||
cookies.set('last_api_response_ud', (this.state.TSDCP), { path: '/' });
|
||||
|
||||
localStorage.setItem('UIfx', 0.6);
|
||||
localStorage.setItem('SDCP', (this.state.TSDCP));
|
||||
|
||||
const usernameST = this.state.username;
|
||||
const password = this.state.password;
|
||||
|
||||
this.triggerSOTF();
|
||||
|
||||
const userID = JSON.parse(proccessForParse)['user_id'];
|
||||
let avatar = JSON.parse(proccessForParse)['avatar'];
|
||||
|
||||
const { dispatch } = this.props;
|
||||
let dispatchPayloadValue = { userID, usernameST, avatar, accessTokesParsed };
|
||||
setTimeout(function () { dispatch({ type: 'login/login', payload: dispatchPayloadValue }) }, 1300)
|
||||
UIFxPY(UIFxList.notifySuccess, 0.5);
|
||||
console.log('%c 🎉 Your data has been storaged in SDCP with this values 🎉 =>', 'background: orange; font-size: 16px; color: white; display: block;', dispatchPayloadValue);
|
||||
|
||||
}
|
||||
processRGSuccess() {
|
||||
// CREATE SDCP PACKAGE
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const accessTokesParsed = JSON.parse(this.state.api_response)['access_token'];
|
||||
const userDataParsed = JSON.parse(this.state.api_response_ud)['user_data'];
|
||||
this.setState({ user_data: userDataParsed });
|
||||
const proccessForParse = JSON.stringify(this.state.user_data);
|
||||
const icryptr = new Cryptr(accessTokesParsed);
|
||||
const encryptedString = icryptr.encrypt(proccessForParse);
|
||||
|
||||
this.setState({ access_token: accessTokesParsed, TSDCP: encryptedString });
|
||||
|
||||
cookies.set('access_token', accessTokesParsed, { path: '/' });
|
||||
cookies.set('last_api_response', nonProccesContainer, { path: '/' });
|
||||
cookies.set('last_api_response_ud', (this.state.TSDCP), { path: '/' });
|
||||
|
||||
localStorage.setItem('UIfx', 0.6);
|
||||
localStorage.setItem('SDCP', (this.state.TSDCP));
|
||||
|
||||
const usernameST = this.state.RGUsername;
|
||||
|
||||
this.triggerRGSOTF();
|
||||
|
||||
const userID = JSON.parse(proccessForParse)['user_id'];
|
||||
const identADMINType = JSON.parse(proccessForParse)['admin'];
|
||||
const identDEVELOPERType = JSON.parse(proccessForParse)['dev'];
|
||||
|
||||
let avatar = JSON.parse(proccessForParse)['avatar'];
|
||||
|
||||
const { dispatch } = this.props;
|
||||
let dispatchPayloadValue = { userID, usernameST, avatar, accessTokesParsed };
|
||||
setTimeout(function () { dispatch({ type: 'login/login', payload: dispatchPayloadValue }) }, 1300)
|
||||
UIFxPY(UIFxList.notifySuccess, 0.3);
|
||||
console.log('%c 🎉 Your data has been storaged in SDCP with this values 🎉 =>', 'background: orange; font-size: 16px; color: white; display: block;', dispatchPayloadValue);
|
||||
|
||||
}
|
||||
|
||||
processJSON() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer);
|
||||
const identStatus = JSON.parse(nonProccesContainer)['api_status'];
|
||||
if (DevOptions.InfiniteLogin == false) {
|
||||
if (identStatus == '400') {
|
||||
this.processError();
|
||||
}
|
||||
|
||||
if (identStatus == '200') {
|
||||
this.getUserData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processRGJSON() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer);
|
||||
const identStatus = JSON.parse(nonProccesContainer)['api_status'];
|
||||
if (identStatus == '400') {
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 }),
|
||||
this.processError();
|
||||
}
|
||||
|
||||
if (identStatus == '200') {
|
||||
this.getRGUserData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
const ErrorType = this.state.ErrorType;
|
||||
const MensageException = this.state.EXCPMS;
|
||||
const ExceptionID = this.state.ExceptionID;
|
||||
const { Panel } = Collapse;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div id='ErrorNotification' style={{ display: 'none', marginTop: '15%' }}><Result status="error" title="There are some problems with your operation." /></div>
|
||||
<YIDForms />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default YulioID
|
@ -1,738 +0,0 @@
|
||||
//****************************************|
|
||||
//**** Yulio ID v1.6 *****|
|
||||
//****************************************|
|
||||
//
|
||||
// @ Licensed by RageStudio(c) 2019
|
||||
// @ Build 03102019EU21700 F/WIAPIS
|
||||
// @ https://api.ragestudio.net/RS-YIBTP
|
||||
//
|
||||
//****************************************|
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'dva'
|
||||
import { Button, Row, Form, Input, Drawer, Icon, Collapse, Select, Checkbox, Result, Layout, message, notification } from 'antd'
|
||||
import { Trans, withI18n } from '@lingui/react'
|
||||
import { setLocale } from 'utils'
|
||||
import { UIFxPY, UIFxList, DevOptions, avilableSDCP } from 'ycore';
|
||||
import { endpoints } from 'ycore';
|
||||
import router from 'umi/router'
|
||||
import $ from 'jquery';
|
||||
import styles from './yid.scss';
|
||||
|
||||
// import {getUserData, getUserRGData, getRegister, getAuth, resetToken, processError, processSuccess, processRGSuccess, processJSON, processRGJSON} from './loginFunctions.js';
|
||||
|
||||
import Cookies from 'universal-cookie';
|
||||
import Cryptr from 'cryptr';
|
||||
|
||||
const cookies = new Cookies();
|
||||
|
||||
const FormItem = Form.Item
|
||||
|
||||
|
||||
const RenderInclude = ({data}) => {if (!data) {return null;} else {return data;}}
|
||||
|
||||
|
||||
|
||||
@withI18n()
|
||||
@connect(({ loading }) => ({ loading }))
|
||||
@Form.create()
|
||||
class YulioID extends PureComponent {
|
||||
|
||||
constructor(props) {
|
||||
super()
|
||||
this.state = {
|
||||
// Drawers Visibility (Default on False)
|
||||
MainLoginVisible: false,
|
||||
NOTFdrawer: false,
|
||||
SOTFdrawer: false,
|
||||
RGSOTFdrawer: false,
|
||||
registerVisible: false,
|
||||
ForggotPasswordVisible: false,
|
||||
// Arrays
|
||||
ErrorType: '',
|
||||
FailArray: '',
|
||||
username: '',
|
||||
password: '',
|
||||
server_key: '',
|
||||
access_token: '',
|
||||
user_data: [],
|
||||
ExceptionID: '',
|
||||
EXCPMS: '',
|
||||
CompleteFORM: '',
|
||||
TSDCP: '',
|
||||
user_id: '',
|
||||
api_response: {},
|
||||
api_response_ud: [],
|
||||
RGUsername: '',
|
||||
RGEmail: '',
|
||||
RGPassword: '',
|
||||
RGGender: '',
|
||||
}
|
||||
this.getAuth = this.getAuth.bind(this);
|
||||
this.getRegister = this.getRegister.bind(this);
|
||||
this.getUserData = this.getUserData.bind(this);
|
||||
this.initRegister = this.initRegister.bind(this);
|
||||
this.initFPassword = this.initFPassword.bind(this);
|
||||
this.cancelRegister = this.cancelRegister.bind(this);
|
||||
this.cancelRecoverPassword = this.cancelRecoverPassword.bind(this);
|
||||
this.closeNOTF = this.closeNOTF.bind(this);
|
||||
this.closeSOTF = this.closeSOTF.bind(this);
|
||||
this.closeRGSOTF = this.closeSOTF.bind(this);
|
||||
this.processSuccess = this.processSuccess.bind(this);
|
||||
this.processRGSuccess = this.processSuccess.bind(this);
|
||||
this.processJSON = this.processJSON.bind(this);
|
||||
this.processRGJSON = this.processJSON.bind(this);
|
||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||
}
|
||||
// Handlers & others
|
||||
handleUsername(text) {
|
||||
this.setState({ username: text.target.value })
|
||||
}
|
||||
handlePassword(text) {
|
||||
this.setState({ password: text.target.value })
|
||||
}
|
||||
handleRGUsername(text) {
|
||||
this.setState({ RGUsername: text.target.value })
|
||||
}
|
||||
handleRGPassword(text) {
|
||||
this.setState({ RGPassword: text.target.value })
|
||||
}
|
||||
handleRGEmail(text) {
|
||||
this.setState({ RGEmail: text.target.value })
|
||||
}
|
||||
handleRGGender(Ivalue) {
|
||||
this.setState({ RGGender: Ivalue })
|
||||
}
|
||||
handleFPEmail(Ivalue) {
|
||||
this.setState({ FGEmail: Ivalue })
|
||||
}
|
||||
|
||||
triggerNOTF() {
|
||||
this.setState({ NOTFdrawer: true });
|
||||
}
|
||||
closeNOTF() {
|
||||
this.setState({ NOTFdrawer: false });
|
||||
}
|
||||
|
||||
triggerSOTF() {
|
||||
this.setState({ SOTFdrawer: true });
|
||||
}
|
||||
closeSOTF() {
|
||||
this.setState({ SOTFdrawer: false });
|
||||
}
|
||||
|
||||
triggerRGSOTF() {
|
||||
this.setState({ RGSOTFdrawer: true });
|
||||
}
|
||||
closeRGSOTF() {
|
||||
this.setState({ RGSOTFdrawer: false });
|
||||
}
|
||||
|
||||
cancelRegister() {
|
||||
this.setState({ registerVisible: false })
|
||||
}
|
||||
cancelRecoverPassword(){
|
||||
this.setState({ ForggotPasswordVisible: false })
|
||||
}
|
||||
|
||||
initRegister() {
|
||||
var messageListener = message.loading('Initialising YulioID...', 1.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisableRegister == false) {
|
||||
this.setState({ registerVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Cannot connect to YulioID Services (Disabled Register)', 2.5))
|
||||
}
|
||||
}
|
||||
|
||||
initFPassword() {
|
||||
var messageListener = message.loading('Initialising YulioID...', 1.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisablePasswordRecover == false) {
|
||||
this.setState({ ForggotPasswordVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Cannot connect to YulioID Services (Disabled Password Recovery)', 2.5))
|
||||
}
|
||||
}
|
||||
ValidateSession() {
|
||||
if (DevOptions.DisableLogin == false) {
|
||||
this.setState({ MainLoginVisible: true })
|
||||
}
|
||||
else {
|
||||
message.error('Error trying to connect to YulioID services', 2.5)
|
||||
$("#ErrorNotification").css({ display: 'block' })
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// INIT
|
||||
this.setState({ server_key: endpoints.server_key });
|
||||
this.ValidateSession();
|
||||
|
||||
const istoken = localStorage.getItem('access_token');
|
||||
const isdone = this.state.CompleteFORM;
|
||||
const getSDCP = localStorage.getItem('SDCP');
|
||||
const availableToken = cookies.get('access_token')
|
||||
if (availableToken) {
|
||||
this.resetToken()
|
||||
|
||||
}
|
||||
|
||||
if (isdone == 'true') {
|
||||
setTimeout(() => { location.reload() }, 3000);
|
||||
}
|
||||
if (!getSDCP) {
|
||||
localStorage.setItem('GetNewData', true);
|
||||
}
|
||||
}
|
||||
|
||||
resetToken() {
|
||||
let _this = this;
|
||||
const tojb1 = endpoints.removeToken;
|
||||
const tobj2 = cookies.get('access_token')
|
||||
let urlOBJ = `${tojb1}${tobj2}`;
|
||||
UIFxPY(UIFxList.notifyWarning)
|
||||
var form = new FormData();
|
||||
form.append("server_key", endpoints.server_key);
|
||||
|
||||
|
||||
var settings = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form
|
||||
};
|
||||
$.ajax(settings).done(function (response) {
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'For continue your request, is necessary to login with YulioID™ again',
|
||||
description:
|
||||
'LoginBridge™ report a access token expiration, and is required you for continue login again with security reasons.',
|
||||
icon: <Icon type="login" style={{ color: '#108ee9' }} />,
|
||||
});
|
||||
cookies.remove('access_token', { path: '/' })
|
||||
});
|
||||
}
|
||||
getUserData() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const IdFromLRApi = JSON.parse(nonProccesContainer)['user_id'];
|
||||
const getStoragedToken = JSON.parse(nonProccesContainer)['access_token'];
|
||||
|
||||
var form2 = new FormData();
|
||||
form2.append("server_key", endpoints.server_key);
|
||||
form2.append("fetch", "user_data,email,username,avatar");
|
||||
form2.append("user_id", IdFromLRApi);
|
||||
|
||||
let _this = this;
|
||||
const yCore_GUDEP = endpoints.get_userData_endpoint;
|
||||
let urlOBJ = `${yCore_GUDEP}${getStoragedToken}`;
|
||||
|
||||
var settings2 = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form2
|
||||
};
|
||||
$.ajax(settings2)
|
||||
.done(function (response2) {
|
||||
_this.setState({ api_response_ud: response2 }),
|
||||
_this.processSuccess();
|
||||
})
|
||||
}
|
||||
getUserRGData() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const IdFromLRApi = JSON.parse(nonProccesContainer)['user_id'];
|
||||
const getStoragedToken = JSON.parse(nonProccesContainer)['access_token'];
|
||||
|
||||
var form2 = new FormData();
|
||||
form2.append("server_key", endpoints.server_key);
|
||||
form2.append("fetch", "user_data,email,username,avatar");
|
||||
form2.append("user_id", IdFromLRApi);
|
||||
|
||||
let _this = this;
|
||||
const yCore_GUDEP = endpoints.get_userData_endpoint;
|
||||
let urlOBJ = `${yCore_GUDEP}${getStoragedToken}`;
|
||||
|
||||
var settings2 = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form2
|
||||
};
|
||||
|
||||
$.ajax(settings2)
|
||||
.done(function (response2) {
|
||||
_this.setState({ api_response_ud: response2 }),
|
||||
_this.processRGSuccess();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
getRegister() {
|
||||
$("#loadingRGspn").css({ opacity: 1, "z-index": 5 });
|
||||
const username = this.state.RGUsername;
|
||||
const password = this.state.RGPassword;
|
||||
const email = this.state.RGEmail;
|
||||
const confirm_password = this.state.RGPassword;
|
||||
const server_key = this.state.server_key;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("server_key", server_key);
|
||||
form.append("username", username);
|
||||
form.append("email", email);
|
||||
form.append("password", password);
|
||||
form.append("confirm_password", confirm_password);
|
||||
|
||||
var settings = {
|
||||
"url": endpoints.register_endpoint,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form,
|
||||
};
|
||||
|
||||
let _this = this;
|
||||
$.ajax(settings)
|
||||
.done(function (response) {
|
||||
_this.setState({ api_response: response }),
|
||||
_this.processRGJSON();
|
||||
})
|
||||
.fail(function (response) {
|
||||
|
||||
_this.setState({
|
||||
FailArray: 'Server Failure',
|
||||
ErrorType: '1',
|
||||
api_response: 'Cannot catch response, Error 500',
|
||||
ExceptionID: '500',
|
||||
EXCPMS: 'Cannot catch response, Error 500',
|
||||
|
||||
}),
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 }),
|
||||
_this.triggerNOTF();
|
||||
})
|
||||
}
|
||||
|
||||
RecoverPassword(inputIO){
|
||||
const cookies = new Cookies();
|
||||
let _this = this;
|
||||
const tojb1 = endpoints.resetPassword_endpoint;
|
||||
const tobj2 = cookies.get('access_token')
|
||||
let urlOBJ = `${tojb1}${tobj2}`;
|
||||
UIFxPY(UIFxList.notifyWarning)
|
||||
var form = new FormData();
|
||||
form.append("server_key", endpoints.server_key);
|
||||
form.append("email", inputIO);
|
||||
|
||||
var settings = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form
|
||||
};
|
||||
$.ajax(settings).done(function (response) {
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'The instructions to recover your account have been sent to the email',
|
||||
description:
|
||||
'If you cant find the email, try looking for it in the spam folder or try again',
|
||||
icon: <Icon type="mail" style={{ color: '#108ee9' }} />,
|
||||
});
|
||||
console.log(response)
|
||||
});
|
||||
}
|
||||
|
||||
getAuth() {
|
||||
$("#loadingspn").css({ opacity: 1, "z-index": 5 });
|
||||
const username = this.state.username;
|
||||
const password = this.state.password;
|
||||
const server_key = this.state.server_key;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("server_key", server_key);
|
||||
form.append("username", username);
|
||||
form.append("password", password);
|
||||
var settings = {
|
||||
"url": endpoints.auth_endpoint,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form,
|
||||
};
|
||||
|
||||
let _this = this;
|
||||
$.ajax(settings)
|
||||
.done(function (response) {
|
||||
_this.setState({ api_response: response }),
|
||||
_this.processJSON();
|
||||
})
|
||||
.fail(function (response) {
|
||||
|
||||
_this.setState({
|
||||
FailArray: 'Server Failure',
|
||||
ErrorType: '1',
|
||||
api_response: 'Cannot catch response, Error 500',
|
||||
ExceptionID: '500',
|
||||
EXCPMS: 'Cannot catch response, Error 500',
|
||||
|
||||
}),
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'Currently our servers are having operating problems',
|
||||
description: 'Please be patient until the services become available again, try again later. We apologize for the inconveniences',
|
||||
icon: <Icon type="login" style={{ color: '#ff0f2f' }} />
|
||||
}),
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 }),
|
||||
_this.triggerNOTF();
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
processError() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer)['api_status'];
|
||||
const ExceptionMensage = JSON.parse(this.state.api_response)['errors'];
|
||||
const ExcepID = ExceptionMensage.error_id;
|
||||
const ExceptionMensagePRC = ExceptionMensage.error_text;
|
||||
|
||||
if (stringParsed == '400') {
|
||||
this.triggerNOTF();
|
||||
this.setState({ FailArray: 'Bad credentials' });
|
||||
this.setState({
|
||||
ErrorType: stringParsed,
|
||||
ExceptionID: ExcepID
|
||||
});
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 });
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 });
|
||||
this.setState({ EXCPMS: ExceptionMensagePRC });
|
||||
}
|
||||
if (stringParsed == '404') {
|
||||
this.triggerNOTF();
|
||||
this.setState({ ErrorType: stringParsed });
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 });
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 });
|
||||
this.setState({ EXCPMS: ExceptionMensagePRC });
|
||||
}
|
||||
}
|
||||
|
||||
processSuccess() {
|
||||
// CREATE SDCP PACKAGE
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const accessTokesParsed = JSON.parse(this.state.api_response)['access_token'];
|
||||
const userDataParsed = JSON.parse(this.state.api_response_ud)['user_data'];
|
||||
this.setState({ user_data: userDataParsed });
|
||||
const proccessForParse = JSON.stringify(this.state.user_data);
|
||||
const icryptr = new Cryptr(accessTokesParsed);
|
||||
const encryptedString = icryptr.encrypt(proccessForParse);
|
||||
|
||||
this.setState({ access_token: accessTokesParsed, TSDCP: encryptedString });
|
||||
|
||||
cookies.set('access_token', accessTokesParsed, { path: '/' });
|
||||
cookies.set('last_api_response', nonProccesContainer, { path: '/' });
|
||||
cookies.set('last_api_response_ud', (this.state.TSDCP), { path: '/' });
|
||||
|
||||
localStorage.setItem('UIfx', 0.6);
|
||||
localStorage.setItem('SDCP', (this.state.TSDCP));
|
||||
|
||||
const usernameST = this.state.username;
|
||||
|
||||
this.triggerSOTF();
|
||||
|
||||
const userID = JSON.parse(proccessForParse)['user_id'];
|
||||
let avatar = JSON.parse(proccessForParse)['avatar'];
|
||||
|
||||
const { dispatch } = this.props;
|
||||
let dispatchPayloadValue = { userID, usernameST, avatar, accessTokesParsed };
|
||||
setTimeout(function () { dispatch({ type: 'login/login', payload: dispatchPayloadValue }) }, 1300)
|
||||
UIFxPY(UIFxList.notifySuccess, 0.5);
|
||||
console.log('%c 🎉 Your data has been storaged in SDCP with this values 🎉 =>', 'background: orange; font-size: 16px; color: white; display: block;', dispatchPayloadValue);
|
||||
|
||||
}
|
||||
processRGSuccess() {
|
||||
// CREATE SDCP PACKAGE
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const accessTokesParsed = JSON.parse(this.state.api_response)['access_token'];
|
||||
const userDataParsed = JSON.parse(this.state.api_response_ud)['user_data'];
|
||||
this.setState({ user_data: userDataParsed });
|
||||
const proccessForParse = JSON.stringify(this.state.user_data);
|
||||
const icryptr = new Cryptr(accessTokesParsed);
|
||||
const encryptedString = icryptr.encrypt(proccessForParse);
|
||||
|
||||
this.setState({ access_token: accessTokesParsed, TSDCP: encryptedString });
|
||||
|
||||
cookies.set('access_token', accessTokesParsed, { path: '/' });
|
||||
cookies.set('last_api_response', nonProccesContainer, { path: '/' });
|
||||
cookies.set('last_api_response_ud', (this.state.TSDCP), { path: '/' });
|
||||
|
||||
localStorage.setItem('UIfx', 0.6);
|
||||
localStorage.setItem('SDCP', (this.state.TSDCP));
|
||||
|
||||
const usernameST = this.state.RGUsername;
|
||||
|
||||
this.triggerRGSOTF();
|
||||
|
||||
const userID = JSON.parse(proccessForParse)['user_id'];
|
||||
const identADMINType = JSON.parse(proccessForParse)['admin'];
|
||||
const identDEVELOPERType = JSON.parse(proccessForParse)['dev'];
|
||||
|
||||
let avatar = JSON.parse(proccessForParse)['avatar'];
|
||||
|
||||
const { dispatch } = this.props;
|
||||
let dispatchPayloadValue = { userID, usernameST, avatar, accessTokesParsed };
|
||||
setTimeout(function () { dispatch({ type: 'login/login', payload: dispatchPayloadValue }) }, 1300)
|
||||
UIFxPY(UIFxList.notifySuccess, 0.3);
|
||||
console.log('%c 🎉 Your data has been storaged in SDCP with this values 🎉 =>', 'background: orange; font-size: 16px; color: white; display: block;', dispatchPayloadValue);
|
||||
|
||||
}
|
||||
|
||||
processJSON() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer);
|
||||
const identStatus = JSON.parse(nonProccesContainer)['api_status'];
|
||||
if (DevOptions.InfiniteLogin == false) {
|
||||
if (identStatus == '400') {
|
||||
this.processError();
|
||||
}
|
||||
|
||||
if (identStatus == '200') {
|
||||
this.getUserData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processRGJSON() {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer);
|
||||
const identStatus = JSON.parse(nonProccesContainer)['api_status'];
|
||||
if (identStatus == '400') {
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 }),
|
||||
this.processError();
|
||||
}
|
||||
|
||||
if (identStatus == '200') {
|
||||
this.getRGUserData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
handleKeyDown = (e) => {
|
||||
const _this = this;
|
||||
if (e.key === 'Enter') {
|
||||
this.getAuth
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
render() {
|
||||
const { loading, form, i18n, include} = this.props
|
||||
const ErrorType = this.state.ErrorType;
|
||||
const MensageException = this.state.EXCPMS;
|
||||
const ExceptionID = this.state.ExceptionID;
|
||||
const { Panel } = Collapse;
|
||||
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div id='ErrorNotification' style={{ display: 'none', marginTop: '15%' }}><Result status="error" title="There are some problems with your operation." /></div>
|
||||
|
||||
|
||||
{/* LOGIN SECTION */}
|
||||
<Drawer width={520} closable={false} visible={this.state.MainLoginVisible}>
|
||||
|
||||
<main className={styles.mainlp}>
|
||||
<section className={styles.forms}>
|
||||
|
||||
<h6 className={styles.h6lp}>YulioID™</h6>
|
||||
<h1 className={styles.h1lp}>Welcome Back !</h1>
|
||||
|
||||
|
||||
<form className={styles.formlogin}>
|
||||
|
||||
<div className={styles.input__wrapper}>
|
||||
|
||||
<label className={styles.labelform}><Icon type="user" style={{ fontSize: '15px' }} /> Username</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('Username', { rules: [{ required: true }] })(
|
||||
<input className={styles.inputform} type="text" onKeyDown={this.handleKeyDown} placeholder="Username" onChange={(text) => { this.handleUsername(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<div className={styles.input__wrapper}>
|
||||
<label className={styles.labelform}><Icon type="unlock" style={{ fontSize: '15px' }} /> Password</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('Password', { rules: [{ required: true }] })(
|
||||
<input className={styles.inputform} type="password" onKeyDown={this.handleKeyDown} dplaceholder="Password (At least 8 characters)" onChange={(text) => { this.handlePassword(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
|
||||
<div style={{ margin: 'auto' }}><a className={styles.buttonlp} id="login" onClick={this.getAuth} >Login</a></div>
|
||||
<h2 style={{ textAlign: 'center', margin: '8px', color: '#666' }}>Or</h2>
|
||||
<div style={{ float: 'left' }}><Button type="dashed" onClick={this.initFPassword} style={{ top: '8px' }}><Icon type="exclamation-circle" /> Forgotten password</Button></div>
|
||||
<div style={{ float: 'right' }}><Button type="dashed" onClick={this.initRegister} style={{ top: '8px' }}><Icon type="user-add" /> Create an account</Button></div><br/><br/>
|
||||
<div style={{ textAlign: 'center', margin: '20px' }}> <RenderInclude data={include} /></div>
|
||||
<div className={styles.spinner__wrapper} id="loadingspn">
|
||||
<div><Icon type="loading" style={{ fontSize: 24, margin: '13px' }} spin /></div>
|
||||
<div>
|
||||
<br /><br /><br />
|
||||
<div style={{ margin: 'auto' }}><h6 className={styles.h6lp} style={{ textAlign: 'center', marginTop: '15%' }}>Wait a sec...</h6></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
</Drawer>
|
||||
|
||||
{/* REGISTER SECTION */}
|
||||
<Drawer width={680} closable={true} onClose={this.cancelRegister} visible={this.state.registerVisible}>
|
||||
<main className={styles.mainlp}>
|
||||
<section className={styles.forms}>
|
||||
<h6 className={styles.h6lp}>YulioID™</h6>
|
||||
<h1 className={styles.h1lp}>Register</h1>
|
||||
<h3>Wow congratulations, very soon you will begin to discover rStudio, but first you will have to start by filling out this form</h3>
|
||||
<form className={styles.formlogin}>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
<label className={styles.labelform}> Choose your Username</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('rgUsername', { rules: [{ required: true }] })(
|
||||
<Input type="text" prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Username" onChange={(text) => { this.handleRGUsername(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
<label className={styles.labelform}> Fill with your email</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('rgEmail', { rules: [{ required: true }] })(
|
||||
<Input type="text" prefix={<Icon type="link" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Email" onChange={(text) => { this.handleRGEmail(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
<label className={styles.labelform}> Fill with your password</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('rgPassword', { rules: [{ required: true }] })(
|
||||
<Input type="password" prefix={<Icon type="key" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Password" onChange={(text) => { this.handleRGPassword(text) }} />
|
||||
)}
|
||||
</FormItem>
|
||||
</div>
|
||||
<div className={styles.inputRG__wrapper}>
|
||||
</div>
|
||||
<div className={styles.TOSAccept}><span><span style={{ color: 'red', fontSize: '17px' }}>*</span> Clicking the register button you accept our <a href="#">terms and conditions</a></span> </div>
|
||||
<a className={styles.buttonlp} id="register" onClick={this.getRegister}>Register</a>
|
||||
<div className={styles.spinner__wrapper} id="loadingRGspn">
|
||||
<div style={{ position: 'absolute', marginLeft: '86%', marginTop: '-65%' }}><Icon type="loading" style={{ fontSize: 24 }} spin /></div>
|
||||
<div>
|
||||
<div><Icon style={{ fontSize: '160px', margin: '30px', color: '#5B2A86' }} type="smile" /></div>
|
||||
<h6 className={styles.h6lp} style={{ textAlign: 'center' }}>Ok thanks, wait a minute...</h6>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</Drawer>
|
||||
|
||||
{/* FORGOTTEN PASSWORD SECTION */}
|
||||
<Drawer width={420} closable={true} onClose={this.cancelRecoverPassword} visible={this.state.ForggotPasswordVisible}>
|
||||
<main className={styles.mainlp}>
|
||||
<section className={styles.forms}>
|
||||
<h6 className={styles.h6lp}>YulioID™</h6>
|
||||
<h1 className={styles.h1lp}>Forgotten Password!</h1>
|
||||
<h3>To recover your account enter the email used to register</h3>
|
||||
<form className={styles.formlogin}>
|
||||
<div className={styles.input__wrapper}>
|
||||
<label className={styles.labelform}><Icon type="mail" style={{ fontSize: '15px' }} /> Email</label>
|
||||
<FormItem hasFeedback>{getFieldDecorator('Email', { rules: [{ required: true }] })(
|
||||
<input className={styles.inputform} type="text" placeholder="myaccount@example.com" onChange={(text) => { this.handleFPEmail(text) }} /> )}
|
||||
</FormItem>
|
||||
</div>
|
||||
{/* <div style={{ margin: 'auto' }}><a className={styles.buttonlp} id="login" onClick={this.RecoverPassword(this.state.FGEmail)}>Recover</a></div> */}
|
||||
<div className={styles.spinner__wrapper} id="loadingspn">
|
||||
<div><Icon type="loading" style={{ fontSize: 24, margin: '13px' }} spin /></div>
|
||||
<div>
|
||||
<br /><br /><br />
|
||||
<div style={{ margin: 'auto' }}><h6 className={styles.h6lp} style={{ textAlign: 'center', marginTop: '15%' }}>Wait a sec...</h6></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</Drawer>
|
||||
|
||||
{/* NOTF */}
|
||||
<Drawer width={320} closable={false} visible={this.state.NOTFdrawer} >
|
||||
<div style={{ textAlign: 'center', color: 'orange' }} ><Icon type="warning" style={{ fontSize: '230px' }} />
|
||||
<h2 className={styles.h2lp}> {this.state.FailArray} </h2>
|
||||
<h4 className={styles.apierrort}> {MensageException} </h4> <hr />
|
||||
<div id="details-collapse" style={{ textAlign: 'center' }}>
|
||||
<Collapse bordered={false} defaultActiveKey={['0']} expandIcon={({ isActive }) => <Icon type="caret-right" rotate={isActive ? 90 : 0} />}>
|
||||
<Panel header="Details" key="1" style={{ borderRadius: 4, marginBottom: 24, border: 0, overflow: 'hidden', }}>
|
||||
<Icon type="exception" />
|
||||
<h6>STATUS HANDLER => {this.state.ErrorType} </h6>
|
||||
<h6>EXCEPTION => {this.state.api_response} </h6>
|
||||
<h6>EXCEPTION MENSAGE => {MensageException}</h6>
|
||||
<h6><strong>ID {ExceptionID}</strong></h6>
|
||||
</Panel>
|
||||
</Collapse>
|
||||
<hr /><Button type="danger" onClick={this.closeNOTF}>TRY AGAIN</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Drawer>
|
||||
|
||||
|
||||
{/* SOTF */}
|
||||
<Drawer width={320} closable={false} visible={this.state.SOTFdrawer}>
|
||||
<div style={{ textAlign: 'center', color: '#4BB543' }} ><Icon type="check" style={{ fontSize: '200px' }} />
|
||||
<h2 className={styles.h2lp} style={{ color: '#4BB543' }} > Success </h2>
|
||||
<h4>Please wait while process your data ...</h4>
|
||||
</div>
|
||||
</Drawer>
|
||||
{/* RGSOTF */}
|
||||
<Drawer width={320} closable={false} visible={this.state.RGSOTFdrawer}>
|
||||
<div style={{ textAlign: 'center', color: 'green' }} >
|
||||
<Icon type="check" style={{ fontSize: '200px' }} />
|
||||
<h2 className={styles.h2lp} style={{ color: 'green' }} > Registered </h2>
|
||||
<h4 className={styles.apierrort}> Welcome to Dashboard, you will start discovering now</h4>
|
||||
<h4>Please check your new data while we are process you ...</h4>
|
||||
</div>
|
||||
</Drawer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
YulioID.propTypes = {
|
||||
form: PropTypes.object,
|
||||
dispatch: PropTypes.func,
|
||||
loading: PropTypes.object,
|
||||
include: PropTypes.object,
|
||||
}
|
||||
|
||||
export default YulioID
|
@ -1,29 +0,0 @@
|
||||
import { router, pathMatchRegexp } from 'utils'
|
||||
import api from 'api'
|
||||
|
||||
const { legacyloginUser } = api
|
||||
|
||||
export default {
|
||||
namespace: 'login',
|
||||
|
||||
state: {},
|
||||
|
||||
effects: {
|
||||
*login({ payload }, { put, call, select }) {
|
||||
const data = yield call(legacyloginUser, payload)
|
||||
const { locationQuery } = yield select(_ => _.app)
|
||||
if (data.success) {
|
||||
const { from } = locationQuery
|
||||
yield put({ type: 'app/query' })
|
||||
if (!pathMatchRegexp('/login', from)) {
|
||||
if (from === '/') router.push('/dashboard')
|
||||
else router.push(from)
|
||||
} else {
|
||||
router.push('/dashboard')
|
||||
}
|
||||
} else {
|
||||
throw data
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
@ -1,431 +0,0 @@
|
||||
//****************************************|
|
||||
//**** yCore SDCP v1.6 *****|
|
||||
//****************************************|
|
||||
//
|
||||
// @ Licensed by RageStudio(c) 2019
|
||||
// @ Build 03102019EU21700 F/WIAPIS
|
||||
// @ https://api.ragestudio.net/RS-YIBTP
|
||||
//
|
||||
//****************************************|
|
||||
|
||||
import React, { PureComponent } from 'react'
|
||||
import { Form, Icon, message, notification } from 'antd'
|
||||
import { UIFxPY, UIFxList, DevOptions } from 'ycoreLegacy';
|
||||
import { endpoints } from 'ycoreLegacy';
|
||||
import $ from 'jquery';
|
||||
|
||||
import Cookies from 'universal-cookie';
|
||||
import Cryptr from 'cryptr';
|
||||
|
||||
const cookies = new Cookies();
|
||||
|
||||
const FormItem = Form.Item
|
||||
|
||||
export class SDCP extends PureComponent {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = {
|
||||
// Arrays
|
||||
ErrorType: '',
|
||||
FailArray: '',
|
||||
username: '',
|
||||
password: '',
|
||||
server_key: '',
|
||||
access_token: '',
|
||||
user_data: [],
|
||||
ExceptionID: '',
|
||||
EXCPMS: '',
|
||||
CompleteFORM: '',
|
||||
TSDCP: '',
|
||||
user_id: '',
|
||||
api_response: {},
|
||||
api_response_ud: [],
|
||||
RGUsername: '',
|
||||
RGEmail: '',
|
||||
RGPassword: '',
|
||||
RGGender: '',
|
||||
}
|
||||
this.getAuth = this.getAuth.bind(this);
|
||||
this.getRegister = this.getRegister.bind(this);
|
||||
this.getUserData = this.getUserData.bind(this);
|
||||
this.initRegister = this.initRegister.bind(this);
|
||||
this.initFPassword = this.initFPassword.bind(this);
|
||||
this.cancelRegister = this.cancelRegister.bind(this);
|
||||
this.cancelRecoverPassword = this.cancelRecoverPassword.bind(this);
|
||||
this.closeNOTF = this.closeNOTF.bind(this);
|
||||
this.closeSOTF = this.closeSOTF.bind(this);
|
||||
this.closeRGSOTF = this.closeSOTF.bind(this);
|
||||
this.processSuccess = this.processSuccess.bind(this);
|
||||
this.processRGSuccess = this.processSuccess.bind(this);
|
||||
this.processJSON = this.processJSON.bind(this);
|
||||
this.processRGJSON = this.processJSON.bind(this);
|
||||
}
|
||||
|
||||
|
||||
initRegister(inputIO) {
|
||||
var messageListener = message.loading('Initialising YulioID Service..', 2.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisableRegister == false) {
|
||||
this.setState({ registerVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Error trying to connect to YulioID services', 2.5))
|
||||
}
|
||||
}
|
||||
|
||||
initFPassword(inputIO) {
|
||||
var messageListener = message.loading('Initialising YulioID Service..', 2.5)
|
||||
{ messageListener }
|
||||
if (DevOptions.DisablePasswordRecover == false) {
|
||||
this.setState({ ForggotPasswordVisible: true })
|
||||
}
|
||||
else {
|
||||
messageListener.then(() => message.error('Error trying to connect to YulioID services', 2.5))
|
||||
}
|
||||
}
|
||||
ValidateSession(inputIO) {
|
||||
if (DevOptions.DisableLogin == false) {
|
||||
this.setState({ MainLoginVisible: true })
|
||||
}
|
||||
else {
|
||||
message.error('Error trying to connect to YulioID services', 2.5)
|
||||
$("#ErrorNotification").css({ display: 'block' })
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(inputIO) {
|
||||
// INIT
|
||||
this.setState({ server_key: endpoints.server_key });
|
||||
this.ValidateSession();
|
||||
|
||||
const istoken = localStorage.getItem('access_token');
|
||||
const isdone = this.state.CompleteFORM;
|
||||
const getSDCP = localStorage.getItem('SDCP');
|
||||
const availableToken = cookies.get('access_token')
|
||||
if (availableToken) {
|
||||
this.resetToken()
|
||||
}
|
||||
|
||||
if (isdone == 'true') {
|
||||
setTimeout(() => { location.reload() }, 3000);
|
||||
}
|
||||
if (!getSDCP) {
|
||||
localStorage.setItem('GetNewData', true);
|
||||
}
|
||||
}
|
||||
|
||||
resetToken(inputIO) {
|
||||
let _this = this;
|
||||
const tojb1 = endpoints.removeToken;
|
||||
const tobj2 = cookies.get('access_token')
|
||||
let urlOBJ = `${tojb1}${tobj2}`;
|
||||
UIFxPY(UIFxList.notifyWarning)
|
||||
var form = new FormData();
|
||||
form.append("server_key", endpoints.server_key);
|
||||
|
||||
|
||||
var settings = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form
|
||||
};
|
||||
$.ajax(settings).done(function (response) {
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'For continue your request, is necessary to login with YulioID™ again',
|
||||
description:
|
||||
'LoginBridge™ report a access token expiration, and is required you for continue login again with security reasons.',
|
||||
icon: <Icon type="login" style={{ color: '#108ee9' }} />,
|
||||
});
|
||||
cookies.remove('access_token', { path: '/' })
|
||||
});
|
||||
}
|
||||
getUserData(inputIO) {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const IdFromLRApi = JSON.parse(nonProccesContainer)['user_id'];
|
||||
const getStoragedToken = JSON.parse(nonProccesContainer)['access_token'];
|
||||
|
||||
var form2 = new FormData();
|
||||
form2.append("server_key", endpoints.server_key);
|
||||
form2.append("fetch", "user_data,email,username,avatar");
|
||||
form2.append("user_id", IdFromLRApi);
|
||||
|
||||
let _this = this;
|
||||
const yCore_GUDEP = endpoints.get_userData_endpoint;
|
||||
let urlOBJ = `${yCore_GUDEP}${getStoragedToken}`;
|
||||
|
||||
var settings2 = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form2
|
||||
};
|
||||
$.ajax(settings2)
|
||||
.done(function (response2) {
|
||||
_this.setState({ api_response_ud: response2 }),
|
||||
_this.processSuccess();
|
||||
})
|
||||
}
|
||||
getUserRGData(inputIO) {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const IdFromLRApi = JSON.parse(nonProccesContainer)['user_id'];
|
||||
const getStoragedToken = JSON.parse(nonProccesContainer)['access_token'];
|
||||
var form2 = new FormData();
|
||||
form2.append("server_key", endpoints.server_key);
|
||||
form2.append("fetch", "user_data,email,username,avatar");
|
||||
form2.append("user_id", IdFromLRApi);
|
||||
let _this = this;
|
||||
const yCore_GUDEP = endpoints.get_userData_endpoint;
|
||||
let urlOBJ = `${yCore_GUDEP}${getStoragedToken}`;
|
||||
var settings2 = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form2
|
||||
};
|
||||
$.ajax(settings2)
|
||||
.done(function (response2) {
|
||||
_this.setState({ api_response_ud: response2 }),
|
||||
_this.processRGSuccess();
|
||||
})
|
||||
}
|
||||
|
||||
getRegister(inputIO) {
|
||||
$("#loadingRGspn").css({ opacity: 1, "z-index": 5 });
|
||||
const username = this.state.RGUsername;
|
||||
const password = this.state.RGPassword;
|
||||
const email = this.state.RGEmail;
|
||||
const confirm_password = this.state.RGPassword;
|
||||
const server_key = this.state.server_key;
|
||||
var form = new FormData();
|
||||
form.append("server_key", server_key);
|
||||
form.append("username", username);
|
||||
form.append("email", email);
|
||||
form.append("password", password);
|
||||
form.append("confirm_password", confirm_password);
|
||||
var settings = {
|
||||
"url": endpoints.register_endpoint,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form,
|
||||
};
|
||||
let _this = this;
|
||||
$.ajax(settings)
|
||||
.done(function (response) {
|
||||
_this.setState({ api_response: response }),
|
||||
_this.processRGJSON();
|
||||
})
|
||||
.fail(function (response) {
|
||||
|
||||
_this.setState({
|
||||
FailArray: 'Server Failure',
|
||||
ErrorType: '1',
|
||||
api_response: 'Cannot catch response, Error 500',
|
||||
ExceptionID: '500',
|
||||
EXCPMS: 'Cannot catch response, Error 500',
|
||||
|
||||
}),
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 }),
|
||||
_this.triggerNOTF();
|
||||
})
|
||||
}
|
||||
|
||||
RecoverPassword(inputIO){
|
||||
const cookies = new Cookies();
|
||||
let _this = this;
|
||||
const tojb1 = endpoints.resetPassword_endpoint;
|
||||
const tobj2 = cookies.get('access_token')
|
||||
let urlOBJ = `${tojb1}${tobj2}`;
|
||||
UIFxPY(UIFxList.notifyWarning)
|
||||
var form = new FormData();
|
||||
form.append("server_key", endpoints.server_key);
|
||||
form.append("email", inputIO);
|
||||
|
||||
var settings = {
|
||||
"url": urlOBJ,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form
|
||||
};
|
||||
$.ajax(settings).done(function (response) {
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'The instructions to recover your account have been sent to the email',
|
||||
description:
|
||||
'If you cant find the email, try looking for it in the spam folder or try again',
|
||||
icon: <Icon type="mail" style={{ color: '#108ee9' }} />,
|
||||
});
|
||||
console.log(response)
|
||||
});
|
||||
}
|
||||
|
||||
getAuth(inputIO) {
|
||||
$("#loadingspn").css({ opacity: 1, "z-index": 5 });
|
||||
const username = this.state.username;
|
||||
const password = this.state.password;
|
||||
const server_key = this.state.server_key;
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append("server_key", server_key);
|
||||
form.append("username", username);
|
||||
form.append("password", password);
|
||||
var settings = {
|
||||
"url": endpoints.auth_endpoint,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"processData": false,
|
||||
"mimeType": "multipart/form-data",
|
||||
"contentType": false,
|
||||
"data": form,
|
||||
};
|
||||
let _this = this;
|
||||
$.ajax(settings)
|
||||
.done(function (response) {
|
||||
_this.setState({ api_response: response }),
|
||||
_this.processJSON();
|
||||
})
|
||||
.fail(function (response) {
|
||||
_this.setState({
|
||||
FailArray: 'Server Failure',
|
||||
ErrorType: '1',
|
||||
api_response: 'Cannot catch response, Error 500',
|
||||
ExceptionID: '500',
|
||||
EXCPMS: 'Cannot catch response, Error 500',
|
||||
|
||||
}),
|
||||
notification.open({
|
||||
placement: 'topLeft',
|
||||
message: 'Currently our servers are having operating problems',
|
||||
description: 'Please be patient until the services become available again, try again later. We apologize for the inconveniences',
|
||||
icon: <Icon type="login" style={{ color: '#ff0f2f' }} />
|
||||
}),
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 }),
|
||||
_this.triggerNOTF();
|
||||
})
|
||||
}
|
||||
|
||||
processError(inputIO) {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer)['api_status'];
|
||||
const ExceptionMensage = JSON.parse(this.state.api_response)['errors'];
|
||||
const ExcepID = ExceptionMensage.error_id;
|
||||
const ExceptionMensagePRC = ExceptionMensage.error_text;
|
||||
if (stringParsed == '400') {
|
||||
this.triggerNOTF();
|
||||
this.setState({ FailArray: 'Bad credentials' });
|
||||
this.setState({
|
||||
ErrorType: stringParsed,
|
||||
ExceptionID: ExcepID
|
||||
});
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 });
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 });
|
||||
this.setState({ EXCPMS: ExceptionMensagePRC });
|
||||
}
|
||||
if (stringParsed == '404') {
|
||||
this.triggerNOTF();
|
||||
this.setState({ ErrorType: stringParsed });
|
||||
$("#loadingspn").css({ opacity: 0, "z-index": -1 });
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 });
|
||||
this.setState({ EXCPMS: ExceptionMensagePRC });
|
||||
}
|
||||
}
|
||||
|
||||
processSuccess(inputIO) {
|
||||
// CREATE SDCP PACKAGE
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const accessTokesParsed = JSON.parse(this.state.api_response)['access_token'];
|
||||
const userDataParsed = JSON.parse(this.state.api_response_ud)['user_data'];
|
||||
this.setState({ user_data: userDataParsed });
|
||||
const proccessForParse = JSON.stringify(this.state.user_data);
|
||||
const icryptr = new Cryptr(accessTokesParsed);
|
||||
const encryptedString = icryptr.encrypt(proccessForParse);
|
||||
this.setState({ access_token: accessTokesParsed, TSDCP: encryptedString });
|
||||
cookies.set('access_token', accessTokesParsed, { path: '/' });
|
||||
cookies.set('last_api_response', nonProccesContainer, { path: '/' });
|
||||
cookies.set('last_api_response_ud', (this.state.TSDCP), { path: '/' });
|
||||
localStorage.setItem('UIfx', 0.6);
|
||||
localStorage.setItem('SDCP', (this.state.TSDCP));
|
||||
const usernameST = this.state.username;
|
||||
const password = this.state.password;
|
||||
this.triggerSOTF();
|
||||
const userID = JSON.parse(proccessForParse)['user_id'];
|
||||
let avatar = JSON.parse(proccessForParse)['avatar'];
|
||||
const { dispatch } = this.props;
|
||||
let dispatchPayloadValue = { userID, usernameST, avatar, accessTokesParsed };
|
||||
setTimeout(function () { dispatch({ type: 'login/login', payload: dispatchPayloadValue }) }, 1300)
|
||||
UIFxPY(UIFxList.notifySuccess, 0.5);
|
||||
console.log('%c 🎉 Your data has been storaged in SDCP with this values 🎉 =>', 'background: orange; font-size: 16px; color: white; display: block;', dispatchPayloadValue);
|
||||
|
||||
}
|
||||
processRGSuccess(inputIO) {
|
||||
// CREATE SDCP PACKAGE
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const accessTokesParsed = JSON.parse(this.state.api_response)['access_token'];
|
||||
const userDataParsed = JSON.parse(this.state.api_response_ud)['user_data'];
|
||||
this.setState({ user_data: userDataParsed });
|
||||
const proccessForParse = JSON.stringify(this.state.user_data);
|
||||
const icryptr = new Cryptr(accessTokesParsed);
|
||||
const encryptedString = icryptr.encrypt(proccessForParse);
|
||||
this.setState({ access_token: accessTokesParsed, TSDCP: encryptedString });
|
||||
cookies.set('access_token', accessTokesParsed, { path: '/' });
|
||||
cookies.set('last_api_response', nonProccesContainer, { path: '/' });
|
||||
cookies.set('last_api_response_ud', (this.state.TSDCP), { path: '/' });
|
||||
localStorage.setItem('UIfx', 0.6);
|
||||
localStorage.setItem('SDCP', (this.state.TSDCP));
|
||||
const usernameST = this.state.RGUsername;
|
||||
this.triggerRGSOTF();
|
||||
const userID = JSON.parse(proccessForParse)['user_id'];
|
||||
const identADMINType = JSON.parse(proccessForParse)['admin'];
|
||||
const identDEVELOPERType = JSON.parse(proccessForParse)['dev'];
|
||||
let avatar = JSON.parse(proccessForParse)['avatar'];
|
||||
const { dispatch } = this.props;
|
||||
let dispatchPayloadValue = { userID, usernameST, avatar, accessTokesParsed };
|
||||
setTimeout(function () { dispatch({ type: 'login/login', payload: dispatchPayloadValue }) }, 1300)
|
||||
UIFxPY(UIFxList.notifySuccess, 0.3);
|
||||
console.log('%c 🎉 Your data has been storaged in SDCP with this values 🎉 =>', 'background: orange; font-size: 16px; color: white; display: block;', dispatchPayloadValue);
|
||||
}
|
||||
|
||||
processJSON(inputIO) {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer);
|
||||
const identStatus = JSON.parse(nonProccesContainer)['api_status'];
|
||||
if (DevOptions.InfiniteLogin == false) {
|
||||
if (identStatus == '400') {
|
||||
this.processError();
|
||||
}
|
||||
if (identStatus == '200') {
|
||||
this.getUserData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processRGJSON(inputIO) {
|
||||
const nonProccesContainer = this.state.api_response;
|
||||
const stringParsed = JSON.parse(nonProccesContainer);
|
||||
const identStatus = JSON.parse(nonProccesContainer)['api_status'];
|
||||
if (identStatus == '400') {
|
||||
$("#loadingRGspn").css({ opacity: 0, "z-index": -1 }),
|
||||
this.processError();
|
||||
}
|
||||
if (identStatus == '200') {
|
||||
this.getRGUserData();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,6 @@ import UserProfile from './UserProfile'
|
||||
import MainSidebar from './MainSidebar'
|
||||
import PostCard from './PostCard'
|
||||
import PostCreator from './PostCreator'
|
||||
import Editor from './Editor'
|
||||
import FilterItem from './FilterItem'
|
||||
import DropOption from './DropOption'
|
||||
import Loader from './Loader/Loader.js'
|
||||
import ScrollBar from './ScrollBar'
|
||||
import * as MyLayout from './Layout/index.js'
|
||||
@ -13,4 +10,4 @@ import Page from './Page'
|
||||
import YulioID from './YulioID/experimental/index.js'
|
||||
import CoreLoader from './CoreLoader'
|
||||
|
||||
export { UserProfile, MyLayout, Editor, FilterItem, DropOption, Loader, Page, ScrollBar, YulioID, CoreLoader, PostCard, PostCreator, CustomIcons, MainSidebar}
|
||||
export { UserProfile, MyLayout, Loader, Page, ScrollBar, YulioID, CoreLoader, PostCard, PostCreator, CustomIcons, MainSidebar}
|
||||
|
@ -62,11 +62,6 @@ export default {
|
||||
},
|
||||
effects: {
|
||||
*query({payload}, { call, put, select }) {
|
||||
const { locationPathname } = yield select(_ => _.app)
|
||||
const { list } = yield call(queryRouteList)
|
||||
let routeList = list
|
||||
yield put({type: 'updateState', payload: { routeList: list }, })
|
||||
|
||||
const valid = ycore.ValidLoginSession();
|
||||
const validBackup = ycore.ValidBackup();
|
||||
if (valid == true) {
|
||||
@ -74,30 +69,26 @@ export default {
|
||||
router.push({pathname: '/main',})
|
||||
ycore.RefreshONCE()
|
||||
}
|
||||
const { locationPathname } = yield select(_ => _.app)
|
||||
const { list } = yield call(queryRouteList)
|
||||
let routeList = list
|
||||
yield put({type: 'updateState', payload: { routeList: list }, })
|
||||
// Runtime
|
||||
ycore.MakeBackup()
|
||||
ycore.UpdateSDCP()
|
||||
|
||||
}
|
||||
else if(!pathMatchRegexp(['/', '/login'], window.location.pathname)) {
|
||||
else if(!pathMatchRegexp(['','/login'], window.location.pathname)) {
|
||||
console.log('REP')
|
||||
if (validBackup == true) {
|
||||
ycore.LogoutCall()
|
||||
}
|
||||
else{
|
||||
router.push({pathname: '/login',})
|
||||
ycore.RefreshONCE()
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
*signOut({ payload }, { call, put }) {
|
||||
const data = yield call(logoutUser)
|
||||
if (data.success) {
|
||||
sessionStorage.clear()
|
||||
yield put({ type: 'query' })
|
||||
} else {
|
||||
throw data
|
||||
if(pathMatchRegexp(['/'], window.location.pathname)){
|
||||
router.push({pathname: '/login',})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -1,3 +1,4 @@
|
||||
@import '~themes/vars.less';
|
||||
.PostsWrapper{
|
||||
margin: auto;
|
||||
align-content: center;
|
||||
|
Loading…
x
Reference in New Issue
Block a user