Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9103977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:45:19+00:00 2026-06-17T01:45:19+00:00

Am implementing User controller around springsource-security-core plugin. When I show a user instance in

  • 0

Am implementing User controller around springsource-security-core plugin.

When I “show” a user instance in my controller (“User”) I want to ensure that the password parameter is nulled and is displayed as a blank edit control.

This is the code for the “show” method:

@Secured(['ROLE_SUPERUSER','ROLE_USER'])
def show(Long id) {

/**
 * If we're not the Superuser, then we only want to see the instance of the logged in user.
 */
def userInstance

if (SpringSecurityUtils.ifNotGranted('ROLE_SUPERUSER')) {
    userInstance=springSecurityService.currentUser
} else {
    userInstance = User.get(id)
}

    if (!userInstance) {
        flash.message = message(code: 'default.not.found.message', args: [message(code: 'user.label', default: 'User'), id])
        redirect(action: "list")
        return
    }

    userInstance.setPassword(null)

    [userInstance: userInstance]
}

Setting a “watch” on ‘userInstance’ indicates that the userInstance.setPassword(null) has the desired effect and sets the “password” parameter to ‘null’.

However, when the view is rendered with the same parameter set, the password is populated.

I’m looking to implement a “password-confirmation” field as well. I’m a bit new to groovy/grail so I’m feeling my way around this step by step. It appears that by passing in “userInstance” I pass an Instance of the “User” domain class.

Do I need two encoded fields in the domain class or can I add a field to the GSP on the fly and then validate this in the controller before saving the domain class with an encoded password?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:45:20+00:00Added an answer on June 17, 2026 at 1:45 am

    Best way to do this is to use command objects, please see :
    Official documentation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing a method that receive an authentication token from a user. Based
I am implementing a sound effect that plays while a user is dragging a
I am implementing a simple iOS solitaire game that allows the user to drag
I am creating a flight controller application. A bit of functionality that i want
I'm implementing a class that talks to a motor controller over a USB device.
I am implementing in Ruby on Rails, and i want to do so, that
I'm implementing a Model View Control program. I have a class User that has
I am implementing a multi-page form and I want the user to be redirected
I'm implementing Remember Me feature, I want the user to not have to enter
There are many solutions geared toward implementing user-space threads. Be it golang.org goroutines, python's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.