Hi Helix84,
        I think I am nearly there with this code:

        if (email.isEmpty()) {
           Text email_address = identity.addItem().addText("email");
           email_address.setRequired();
           email_address.setLabel(T_email_address);
           email_address.setValue("[email protected]");
       } else {
           identity.addLabel(T_email_address);
           identity.addItem(email);
       }

        But it does not send the value back to the server through the form.
        I need to a textbox as I need to let the user edit the dummy email 
address and have this saved.

        Is there any documentation on this area?

Regards,
        Ben

------------------------------------------------------------------
Dr Ben Ryan
Jorum Technical Coordinator (Services)

5.12 Roscoe Building
The University of Manchester
Oxford Road
Manchester
M13 9PL
Tel: 0160 275 6039
E-mail: [email protected]
------------------------------------------------------------------


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of helix84
Sent: 05 September 2012 14:22
To: Benjamin Ryan
Cc: [email protected]
Subject: Re: [Dspace-tech] Shibboleth authentication

On Wed, Sep 5, 2012 at 3:09 PM, Benjamin Ryan <[email protected]> 
wrote:
>         I do want to display the email address even if it is the empty string 
> so that the user can enter a valid email address.

OK

>         The problem stems from the fact that I don't get an email address 
> from some IDPs (where I do it is set correctly by the authentication code and 
> updated if it has changed).

I understand.

>         I think I have a solution by editing the EditProfile class to show 
> the email address as a label if it was set correctly or show the unset 
> address (i.e with some placeholder text such as "[email protected]") in a 
> text field.

Exactly what I suggested.

>         The problem I am having with this is that it does not update the 
> details in the database because I assume I am not using the correct 
> label/message for the field.

You have to keep the input field and its name (email) because it's also the 
name of the form parameter.
So, what you probably need to do (I didn't try it) is to change:

       identity.addLabel(T_email_address);
       identity.addItem(email);

to something like this

       identity.addLabel(T_email_address);
if (email == null) { // well, either null or an empty string, not sure
       identity.addItem("[email protected]");
} else {
       identity.addItem(email);
}

Regards,
~~helix84
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to