11

Is there a way that I can create my own custom login page and send the data to login controller of spring security plugin. I currently see my code redirecting directly to the default login page of spring security plugin.

Rammohan
  • 493
  • 6
  • 27

2 Answers2

27

The 2.0 plugin comes with its own auth.gsp page, so if you create your own (either modify the plugin's or create your own) and put it in grails-app/views/login/auth.gsp it will be used. In 1.2.x the auth.gsp is in your app source, so edit it there.

If you want to further customize the login process, I did a talk at http://burtbeckwith.com/blog/?p=1090 and there's some sample code that adds a 3rd login parameter. That code is based on the 1.2.x plugin and would need to be updated for 2.0, but the ideas are the same.

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
  • 1
    Hello Burt, If I just create a gsp named auth.gsp and place it in the folder grails-app/views/login/auth.gsp, would it override the default auth.gsp or do I need to create another login controller that extends the login controller provided by the plugin. – Rammohan Jan 03 '14 at 19:56
  • 2
    You only need to do this for auth.gsp, but you can do both or either - application classes and GSPs always override those from plugins. – Burt Beckwith Jan 03 '14 at 20:42
  • Thanks for the quick response. I really appreciate it. – Rammohan Jan 04 '14 at 08:22
1

I copied the file auth.gsp from here:

https://github.com/grails-plugins/grails-spring-security-core/blob/master/grails-app/views/login/auth.gsp

to grails-app/views/login/auth.gsp

Fusca Software
  • 709
  • 6
  • 11