2017-05-26 38 views
0

我已經安裝了Spring Security UI。它正在與默認字段:如何自定義Spring Security UI爲Grails 3.2.9和Spring Security UI添加字段3.0.0.M2

  • 用戶名
  • 電子郵件
  • 密碼
  • 密碼2

我要添加更多的字段。例如:

  • phoneNumber的
  • 的firstName
  • lastName的

所以I型:

的grails s2ui-倍率註冊的packageName 它創建其延伸一個空類:grails.plugins .springsecurity.ui.RegisterController。

我見過以前的問題,但他們的解決方案不適用於Grails 3.2.9(或Grails 3.2)和Spring Security UI 3.0.0.M2。

有沒有人知道如何輕鬆地爲更新的Grails版本做到這一點。

回答

0

添加下面RegisterCommand:

String organisation 

String landline 

String mobile 

static constraints = { ... 

organisation blank: false 

mobile blank: false 

} 

添加下面User.groovy域:

String organisation 

String landline 

String mobile 

static constraints = { 

... 

mobile nullable:false 

organisation nullable:false 

} 

其添加到index.gsp

<s2ui:textFieldRow name='organisation' bean="${command}" value="${command.organisation}" 

          size='40' class='form-control' labelCodeDefault='Organisation' labelCode='user.organisation.label'/> 



<s2ui:textFieldRow name='mobile' bean="${command}" value="${command.mobile}" 

          size='40' class='form-control' labelCodeDefault='Mobile' labelCode='user.mobile.label'/> 



<s2ui:textFieldRow name='landline' bean="${command}" value="${command.landline}" 

          size='40' class='form-control' labelCodeDefault='Landline' labelCode='user.landline.label'> 

參考link

相關問題