Fortunately there is no admin role. In fact, if they changed it to teacher, 
they would just have access to the teacher stuff. Not a security risk 
fortunately. 

What I'm trying to do is have two forms on the same page, but them not 
share the flash verification warnings that come back. Right now if I don't 
type the email correctly in the register form, the warning tells me in both 
the login and registration form that the email is not formatted properly. 
I'd like two separate auth models to post to the same database, but not 
share the same "email", "password" names to work properly.

Can someone point me to some examples or documentation? 

On Thursday, April 4, 2013 7:32:00 AM UTC-4, André Luis wrote:
>
> I really didnt get what you want to do, but one thing... if anyone can 
> register, do not use the hidden field for the role, because it´s value can 
> be changed easily with some javascript, or even with webdesigner toold. For 
> example, if I (studant) will register and watch the code in Chrome, with 
> developer tools, and see the hidden field with que "student" value, i would 
> try to change the value to "admin" for example, or try another possible 
> keywords for example.
>
> Em quarta-feira, 3 de abril de 2013 20h25min51s UTC-3, Nathan Pierce 
> escreveu:
>>
>> Hey all! I have to say this community is awesome. I'm pleased to see 
>> there is help for newbies like me.
>>
>> I have an issue which I need suggestions for. I like doing things the 
>> proper way and not creating an obtuse mess of code to do something simple. 
>> Here it is:
>>
>> Uses Auth (nothing crazy)
>>
>> View - register.ctp contains a registration form: 
>>
>> <?php
>> echo $this->Form->create('User', array('action' => 'register'));
>> echo $this->Form->input('full_name', array('label' => 'Full Name'));
>> echo $this->Form->input('email_register', array('label' => 'Email'));
>> echo $this->Form->input('password', array('type' => 'password', 'label' 
>> => 'Password'));
>> echo $this->Form->input('password_confirm', array('type' => 'password', 
>> 'label' => 'Confirm Password'));
>> echo $this->Form->hidden('role', array('value' => 'student'));
>> echo $this->Form->end('Register');
>> ?>
>>
>> Then, the layout it uses (login.ctp) calls another form:
>>
>> <?php
>> echo $this->Form->create('User', array('action' => 'login'));
>> echo $this->Form->input('email', array('label' => false, 'type' => 
>> 'email_login', 'value' => '', 'placeholder' => 'Email'));
>> echo $this->Form->input('password', array('label' => false, 'type' => 
>> 'password_login', 'value' => '', 'placeholder' => 'Password'));
>> echo $this->Form->submit('GO', array('class' => 'login_submit'));
>> echo $this->Form->end();
>> ?>
>>
>> My problem is that when register.ctp passes the data to the User.php 
>> model, and does the validation, the login.ctp form gets the 'message =>' 
>> from the model as well as the register.ctp form.
>>
>> Now, I need both the register.ctp and login.ctp form to check the 
>> database if the email exists, run the validation if it's valid, etc etc. I 
>> think you get the idea. My first idea was to change the login.ctp form from 
>> input('email' to input('email_login' and have it act the same as the normal 
>> email, just ignore the validation message. I looked and looked and couldn't 
>> find any examples of how to achieve this. 
>>
>> Any suggestions?
>>
>> Thanks!
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to