Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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.3
FAQs
account registration system
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.