Grails-用于用户名的Spring安全UI电子邮件

Grails-用于用户名的Spring安全UI电子邮件,grails,spring-security,grails-plugin,Grails,Spring Security,Grails Plugin,我正在使用Grails3.2.4,并试图使用我的用户类的email属性作为注册用户名 到目前为止,我已经通过以下配置设置成功地让Spring Security Core使用电子邮件作为用户名: grails.plugin.springsecurity.userLookup.usernamePropertyName='email' 但是,注册功能似乎没有考虑到这一点,也不允许我仅使用电子邮件和密码注册新用户 我已经尝试过几次重写RegisterController,但仍然会遇到关于空用户名的不同

我正在使用Grails3.2.4,并试图使用我的用户类的email属性作为注册用户名

到目前为止,我已经通过以下配置设置成功地让Spring Security Core使用电子邮件作为用户名:

grails.plugin.springsecurity.userLookup.usernamePropertyName='email'
但是,注册功能似乎没有考虑到这一点,也不允许我仅使用电子邮件和密码注册新用户

我已经尝试过几次重写RegisterController,但仍然会遇到关于空用户名的不同错误


看来我一定错过了一些很简单的东西。非常感谢您提供的任何帮助/指导。

在版本spring-security-ui-3.0.0.M2中,
username
属性可能无法覆盖

String paramNameToPropertyName(String paramName, String controllerName) {
    // Properties in the ACL classes and RegistrationCode aren't currently
    // configurable, and the PersistentLogin class is generated but its
    // properties also aren't configurable. Since this method is only by
    // the controllers to be able to hard-code param names and lookup the
    // actual domain class property name we can short-circuit the logic here.
    // Additionally there's no need to support nested properties (e.g.
    // 'aclClass.className' for AclObjectIdentity search) since those are
    // not used in GSP for classes with configurable properties.

    if (!paramName) {
        return paramName
    }

    Class<?> clazz = domainClassesByControllerName[controllerName]
    String name
    if (clazz) {
        String key = paramName
        if (paramName.endsWith('.id')) {
            key = paramName[0..-4]
        }
        name = classMappings[clazz][key]
    }
    name ?: paramName
}

检查username属性的用户域类中的约束-如果db之前已经创建,并且可以为null false,并且之后更改为true-则需要手动db upate将表更改列更改为可以为null。您在没有任何实际代码或错误消息的情况下提供了一个疏忽-跟踪或任何人可以在Anks@vahid上提供任何有用的信息,我的问题不需要跟踪,因为我在问如何使spring security ui中的注册功能使用电子邮件作为用户名。谢谢!正是我想要的信息。
static transients = ["migrating"]]
String username = null

public void setEmail(String email) {
    this.email = email
    this.username = email
}