steroids / auth
2.0.0-beta.53
2022-06-29 03:44 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-mbstring: *
- lib-pcre: *
- bacon/bacon-qr-code: ^2.0
- google/apiclient: ^2.5
- league/oauth2-facebook: ^2.0
- pragmarx/google2fa: ^8.0
- steroids/core: ^2.0@beta
- vkcom/vk-php-sdk: ^5.101
- dev-master
- 2.0.0-beta.53
- 2.0.0-beta.52
- 2.0.0-beta.51
- 2.0.0-beta.50
- 2.0.0-beta.49
- 2.0.0-beta.48
- 2.0.0-beta.47
- 2.0.0-beta.46
- 2.0.0-beta.45
- 2.0.0-beta.44
- 2.0.0-beta.43
- 2.0.0-beta.42
- 2.0.0-beta.41
- 2.0.0-beta.40
- 2.0.0-beta.39
- 2.0.0-beta.38
- 2.0.0-beta.37
- 2.0.0-beta.36
- 2.0.0-beta.35
- 2.0.0-beta.34
- 2.0.0-beta.33
- 2.0.0-beta.32
- 2.0.0-beta.31
- 2.0.0-beta.30
- 2.0.0-beta.29
- 2.0.0-beta.28
- 2.0.0-beta.27
- 2.0.0-beta.26
- 2.0.0-beta.25
- 2.0.0-beta.24
- 2.0.0-beta.23
- 2.0.0-beta.22
- 2.0.0-beta.21
- 2.0.0-beta.20
- 2.0.0-beta.19
- 2.0.0-beta.18
- 2.0.0-beta.17
- 2.0.0-beta.16
- 2.0.0-beta.15
- 2.0.0-beta.14
- 2.0.0-beta.13
- 2.0.0-beta.12
- 2.0.0-beta.11
- 2.0.0-beta.10
- 2.0.0-beta.9
- 2.0.0-beta.8
- 2.0.0-beta.7
- 2.0.0-beta.6
- 2.0.0-beta.5
- 2.0.0-beta.4
- 2.0.0-beta.3
- 2.0.0-beta.2
- dev-szverev
This package is auto-updated.
Last update: 2024-08-29 05:24:36 UTC
README
1. 邮箱/电话/登录 + 密码 *(如果 isPasswordAvailable = true)
1.1 注册
RegistrationForm
[login] (email/phone/login)
[password]
[...custom attrubites]
1.2 注册 -> 确认
ConfirmForm
[email/phone]
[code]
1.3 登录
LoginForm
[login] (email/phone/login)
[password]
1.4 登录 -> 确认 *(如果 isPasswordAvailable = false)
ConfirmForm
[email/phone]
[code]
1.5 恢复
RecoveryPasswordForm
[login] (email/phone)
1.6 恢复 -> 确认
RecoveryPasswordConfirmForm
[login] (email/phone)
[code]
2. 通过社交网络(oauth)登录/注册
2.1 登录/注册
ProviderlLoginForm
[socialParams]
2.2 输入邮箱 (如果社交网络没有提供)
SocialEmailForm
[uid]
[email]
2.2 输入邮箱/电话 -> 确认
SocialConfirmForm
[uid]
[email]
[code]
使用 2FA
- 在配置中需要声明可用于 2fa 的提供者,目前可能有两个 -
notifier
和google
。
'modules' => [
'auth' => [
'twoFactorProviders' => [
'notifier' => [],
],
],
],
- 在需要 2FA 的表单中,需要添加 TwoFactorRequireValidator
[
'amount',
TwoFactorRequireValidator::class,
'userId' => $this->user->primaryKey,
'providerName' => 'notifier',
'codeAttribute' => 'code',
]
最后一个参数 codeAttribute
是非必须的。它是在 2fa 使用并在前端表单中直接处理(使用 Form
组件的 onTwoFactor
处理器)的情况下需要的,然后表单发送包含确认码(code
)的同数据。
如果前端没有指定 onTwoFactor
处理器,则代码将在单独的表单(例如,在模态窗口)中输入,并通过 POST /api/v1/auth/2fa/<providerName>/confirm
方法发送到后端。这时不需要指定 codeAttribute
。