我使用everyauth 的密码模块,并在 validateRegistration 方法中注册时进行一些验证,推送一些错误,履行承诺并将其返回。但是这样我在我的视图中丢失了表单数据(即输入的电子邮件、名字、姓氏等),用户必须再次输入它们。
这是我的 validateRegistration 方法:
.validateRegistration (newUserAttrs, errors) ->
login = newUserAttrs.email;
promise = @Promise()
if !newUserAttrs.name.first
errors.push 'Missing first name'
if !newUserAttrs.name.last
errors.push 'Missing last name'
userManager.getUser "Custom", login, (user, err) ->
if user
errors.push('User with the same email already exists!')
promise.fulfill errors
return promise
还有我的玉观
form(action='/register', method='POST')
label(for='firstName') First Name
input(type='text', name='firstName')
label(for='lastName') Last Name
input(type='text', name='lastName')
label(for=everyauth.password.loginFormFieldName) Email
input(type='text', name=everyauth.password.loginFormFieldName)
label(for=everyauth.password.passwordFormFieldName) Password
input(type='password', name=everyauth.password.passwordFormFieldName)
您有什么建议如何将表单数据传递回视图以便填写表单字段?
谢谢