Registration Form

A place for users and developers of the Xataface to discuss and receive support.

Registration Form

Postby Martin Pruss » Fri Mar 20, 2009 3:14 am

hi Steve
Currently I am trying to get my registration form running...
I followed your tutorial (http://xataface.com/documentation/how-t ... gistration)
Step by step but maybe I am missing something.
I am using the latest version of Xataface.

conf.ini has
allow_register = 1

A register Link appears on the login screen
but, when clicked, only the before_registration_form
is shown.
when i look at the source code of the generated page I find a
form with hidden input fields:
Code: Select all
<form>
<form accept-charset="ISO-8859-1" action="http://www.trainingskalender.de/streak/index.php" method="post" name="new_streak_users_record_form" id="new_streak_users_record_form">
<input name="_qf__new_streak_users_record_form" type="hidden" value="" />
<input name="-action" type="hidden" value="register" />
<input name="__keys__[UserID]" type="hidden" value="" />
<input name="-new" type="hidden" value="1" />

etc....


In the Tutorial i found the following:
Please note that the isAdmin() and getUsername() functions
were defined elsewhere and are convience functions
wrapping calls to the Dataface_AuthenticationTool object.

Does this mean that I have to define them somewhere?



cheers
martin
Last edited by Martin Pruss on Sat Mar 21, 2009 4:55 pm, edited 1 time in total.
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby shannah » Fri Mar 20, 2009 9:48 am

You need to allow the "new" permission on the users table for the public in order to allow for public registration.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Martin Pruss » Mon Mar 23, 2009 8:35 am

Hi Steve thanks for your support..
Well..your reply helped...but also made some new problems appear
first:
after the register form was up and running, the filters stopped working and the main table was visible for all ...i think i can solve that on my own by diving deeper in the permissions documentation.

second:
i could'nt make the role field in the users table disapear via the
fields.ini (but i have to, otherwise new users can make themselves admins)
when i add:
[role]
visibility:list = hidden
widget:label = "Test"
widget:description = ""
widget:type = hidden
[email]
visibility:list = hidden
widget:label = "Rechte"
widget:description = ""
widget:type = hidden

only the email field disapears, but it writes Test as a field label

do you have an idea?


Martin
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby shannah » Mon Mar 23, 2009 11:56 am

This is where permissions come in. You need to define more refined permissions for the 'role' field.

e.g.

Code: Select all
function role__permissions(&$record){
    if ( !isAdmin() ) return array('edit'=>0, 'new'=>0);
    return null;
}



Note that this assumes that you have created a function to tell whether the current user is an admin.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Martin Pruss » Tue Mar 24, 2009 1:13 am

Hi Steve..
The Role field still refuses to apply the changes
even when I use the function without conditions e.g.:

Code: Select all
function Role__permissions(&$record){
     return array('edit'=>0, 'new'=>0);
    return null;
}


the role field has a capital R in my case...

??
cheers
martin
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby Martin Pruss » Mon Mar 30, 2009 4:54 am

finally I disabled the display of the role selct box
by css
Code: Select all
#Role{display: none;}


nevertheless I am wondering what is so special about the Role field , that I can't hide it via fields.ini
cheers
Martin
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby fongchun » Thu Apr 02, 2009 9:08 am

You should be able to hide it in the fields.ini I believe. You mentioned that the role is a capital 'R" in your database. It might be case sensitive, so make sure it is 'Role' in the fields.ini file too.
fongchun
 
Posts: 30
Joined: Sun Aug 03, 2008 12:23 am
Location: Vancouver, BC

registration almost complete and working ...but..

Postby Martin Pruss » Tue Apr 14, 2009 1:38 am

Hi fongchun..
nope..capital "R" was not the mistake... thanks for the clue

Hi Steve
The registration process works. That means an email is sent to the registrant, with the activation link. and when the activation link is klicked the user can login.

But after saving the register form i get a 404.error:
Not Found

The requested URL /streak/index.php&--msg=Thank+you.+An+email+has+been+sent+to+testuser@gmx.de+with+instructions+on+how+to+complete+the+registration+process. was not found on this server.

and after klicking the activation email I get another one:
Not Found

The requested URL /streak/index.php&--msg=Registration+complete.++You+are+now+logged+in. was not found on this server.

Do you have any ideas what could have been gone wrong?
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby Martin Pruss » Thu Apr 16, 2009 2:17 am

Do i have to redirect to a "thanks for registering" or "activation successful" template html?

thanks
martin
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby shannah » Thu Apr 16, 2009 8:27 am

This may be a small bug in Xataface. You should be able to correct this by inserting the following just before line 172 of actions/register.php:
Line 172 is currently:
Code: Select all
header('Location: '.$url.'&--msg='.urlencode($msg));

Insert the following just before this:
Code: Select all
if ( strpos($url, '?') === false ) $url .= '?';


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Martin Pruss » Thu Apr 16, 2009 2:21 pm

Hi Steve..
Thanks a lot..
this snippet solved my (coding) problems
thousands can register now :wink: ... (as soon as I am done with internationalisation)
cheers
martin
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby yakotey » Fri Oct 23, 2009 11:44 am

shannah wrote:You need to allow the "new" permission on the users table for the public in order to allow for public registration.


Hi Steeve.

How do we achieve that?

My registration form still does not show up.

Thanx.
yakotey
 
Posts: 7
Joined: Mon May 18, 2009 3:21 pm

Postby shannah » Mon Oct 26, 2009 2:47 pm

In the users table delegate class you might have something like:

Code: Select all
function getPermissions(&$record){
    $query =& Dataface_Application::getInstance()->getQuery();
    $user = Dataface_AuthenticationTool::getInstance()->getLoggedInUser();
    if ( !$user  ){
        return array('new'=>1);
    }
    return null;
}



You should be careful to NOT allow access to fields that only an administrator should have access to. For example if you have a field called role that stores the user's role, you would add permissions for that field:

Code: Select all
function role__permissions(&$record){
    if ( !isAdmin() ) return Dataface_PermissionsTool::NO_ACCESS();
    return null;
}


This assumes that you have defined a function somewhere called isAdmin() that tells you whether the current user is an administrator.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 11 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved