
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@startupjs/auth-local
Advanced tools
import { LoginForm, RecoverForm, RegisterForm, ChangePasswordForm } from '@startupjs/auth-local' import Joi from '@hapi/joi' import { Button } from '@startupjs/ui'
@startupjs/auth: >= 0.33.0
text-encoding-polyfill: >= 0.6.7
В корневом index.js добавить:
import 'text-encoding-polyfill'
Импорт стратегии:
import { Strategy as LocalStrategy } from '@startupjs/auth-local/server'
initAuth(ee, {
strategies: [
new LocalStrategy({
onCreatePasswordResetSecret: (userId, secret) => {
// callback
},
onPasswordReset: userId => {
// callback
},
onPasswordChange: userId => {
// callback
},
onCreateEmailChangeSecret: (userId, secret) => {
// callback
},
onEmailChange: userId => {
// callback
}
})
]
})
Форма для авторизации
import { LoginForm } from '@startupjs/auth-local'
Принимает пропсы:
return <LoginForm />
Кастомизация: Пропсы для кастомизации:
properties
из ObjectInput, можно добавить новые поля или заоверайдить стандартныеfunction renderActions ({ onSubmit }) {
return pug`
Button(
style={ marginTop: 16 }
onPress=onSubmit
) Login
`
}
return pug`
LoginForm(
properties={
age: {
input: 'number',
label: 'Age',
placeholder: 'Enter your age'
}
}
validateSchema={
age: Joi.number()
.required()
.messages({
'any.required': 'Fill in the field',
'string.empty': 'Fill in the field'
})
}
renderActions=renderActions
)
`
Форма для регистрации
import { RegisterForm } from '@startupjs/auth-local'
Принимает пропсы:
return <RegisterForm />
Кастомизация: Пропсы для кастомизации:
properties
из ObjectInput, можно добавить новые поля или заоверайдить стандартныеfunction renderActions ({ onSubmit }) {
return pug`
Button(
style={ marginTop: 16 }
onPress=onSubmit
) Sign In
`
}
return pug`
RegisterForm(
properties={
age: {
input: 'number',
label: 'Age',
placeholder: 'Enter your age'
}
}
validateSchema={
age: Joi.number()
.required()
.messages({
'any.required': 'Fill in the field',
'string.empty': 'Fill in the field'
})
}
renderActions=renderActions
)
`
Форма для смены пароля
import { RecoverForm } from '@startupjs/auth-local'
return <RecoverForm />
FAQs
Local auth plugin for StartupJS auth module
The npm package @startupjs/auth-local receives a total of 24 weekly downloads. As such, @startupjs/auth-local popularity was classified as not popular.
We found that @startupjs/auth-local demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.