Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@twreporter/registration
Advanced tools
The host project need to contain following dependency:
Note(deprecated): The package work with next.js
npm i --save twreporter-registration
import SignIn from '../containers/SignIn'
import SignUp from '../containers/SignUp'
import Activation from '../containers/Activation'
import Features from '../containers/features'
import AuthenticationScreen from 'twreporter-registration'
export default function (history = browserHistory) {
return (
<Router history={history} onUpdate={scrollAndFireTracking} >
<Route path="/topics/:slug" component={TopicLandingPage} />
<Route path="/" component={Home} />
<Route path="/" component={App}>
<Route path="signup" component={SignUp} />
<Route path="signin" component={SignIn} />
<Route path="activate" component={Activation} />
<Route path="features" component={AuthenticationScreen(Features)} redirectPath={'/signin'} />
</Route>
</Router>
)
}
import React from 'react'
import { connect } from 'react-redux'
import { SignUpForm } from 'twreporter-registration'
const SignUp = (props) => (
<SignUpForm
title='title'
signUpMessage='signUpMessage'
{...props}
/>
)
export default connect()(SignUp)
import React from 'react'
import { connect } from 'react-redux'
import { SignInForm, FacebookButton, GoogleButton } from 'twreporter-registration'
const SignIn = (props) => (
<SignInForm
title={'title'}
signInRedirectPath = {'/'}
defaultStyle={true}
{...props}
>
<FacebookButton />
<GoogleButton />
</SignInForm>
)
export default connect()(SignIn)
import { Link } from 'react-router'
import { signOutAction } from 'twreporter-registration'
<Link to={`/${memberConfigs.path}`} onClick={() => {signOutAction()}}>
<div>Click here to sign out</div>
</Link>
import React from 'react'
import { ActivePage } from 'twreporter-registration'
import { browserHistory } from 'react-router'
import { connect } from 'react-redux'
const Activation = (props) => (
<div>
<ActivePage
activateRedirectPath={'/'}
browserHistory={browserHistory}
{...props}
/>
</div>
)
import { authReducer, configureReducer } from 'twreporter-registration'
const registrationInitialState = {
apiUrl: '',
signUp: '',
signIn: '',
activate: '',
oAuthProviders: {
google: '',
facebook: ''
},
location: '',
domain: '',
}
const ConfigureReducer = configureReducer(registrationInitialState)
const rootReducer = combineReducers({
authConfigure: ConfigureReducer,
auth: authReducer,
})
export default rootReducer
import cookieParser from 'cookie-parser'
import { configureAction, authUserAction, authInfoStringToObj } from 'twreporter-registration'
server.use(cookieParser())
// The following procedure is for OAuth (Google/Facebook)
// setup token to redux state from cookies
if (req.query.login) {
const authType = req.query.login
const cookies = req.cookies
const authInfoString = cookies.auth_info
const authInfoObj = authInfoStringToObj(authInfoString)
store.dispatch(authUserAction(authType, authInfoObj))
}
// setup authentication api server url and endpoints
const registrationConfigure = {
apiUrl: 'http://localhost:8080',
signUp: '/v1/signup',
signIn: '/v1/login',
activate: '/v1/activate',
oAuthProviders: {
google: '/v1/auth/google',
facebook: '/v1/auth/facebook'
},
location: 'http://testtest.twreporter.org:3000',
domain: 'twreporter.org'
}
store.dispatch(configureAction(registrationConfigure))
import { setupTokenInLocalStorage, deletAuthInfoAction, authUserByTokenAction } from 'twreporter-registration'
// Check if token existed in localStorage and expired
// token can be stored in localStorage in two scenario
// 1. oAuth
// 2. TWReporter account sign in
const { auth } = store.getState()
if(auth.authenticated && auth.authInfo && (auth.authType=== 'facebook' || auth.authType==='google')) {
setupTokenInLocalStorage(auth.authInfo)
store.dispatch(deletAuthInfoAction())
}
// 7 = 7 days
store.dispatch(authUserByTokenAction(7, auth.authType))
.then(() => {})
.catch(() => {})
class SignIn extends React.Component {
static getInitialProps ({ store }) {
const registrationConfigure = {
apiUrl: 'http://testtest.twreporter.org:8080',
signUp: '/v1/signup',
signIn: '/v1/login',
activate: '/v1/activate',
oAuthProviders: {
google: '/v1/auth/google',
facebook: '/v1/auth/facebook'
},
location: 'http://testtest.twreporter.org:3000',
domain: 'twreporter.org'
}
store.dispatch(configureAction(registrationConfigure))
}
render() {
return (
<SignInForm
title={'Sign In to Newsletter'}
browserHistory={Router}
AssignedLink={Link}
signInRedirectPath={'/features'}
location={'http://testtest.twreporter.org:3000/features'}
domain={'twreporter.org'}
account={false}
facebook={true}
google={true}
defaultStyle={false}
/>
)
}
}
npm run dev //development mode
npm run build //production mode
//Hard reload development without npm link
CUSTOMER_FOLDER=/Users/hanReporter/Documents/twReporter_frontEnd/twreporter-react npm run dev
advice for developer/programmer: You can program in es2015 + es2017 and only need to edit files in src directory. All files will be transpiled through babel-preset-es2017 and transferred to lib directory.
TO DO create next version of active page
2.1.0
FAQs
account registration system
The npm package @twreporter/registration receives a total of 15 weekly downloads. As such, @twreporter/registration popularity was classified as not popular.
We found that @twreporter/registration demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.