[eluser]Zimooon[/eluser]
Hi guys,
I use the Ion-Auth Admin tool. Now i did the login in html for a better look.
This is the Controller :
Code:
function login()
{
$this->data['title'] = "Login";
//validate form input
$this->form_validation->set_rules('email', 'Email Address', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == true)
{ //check to see if the user is logging in
//check for "remember me"
$remember = (bool) $this->input->post('remember');
if ($this->ion_auth->login($this->input->post('email'), $this->input->post('password'), $remember))
{ //if the login is successful
//redirect them back to the home page
$this->session->set_flashdata('message', $this->ion_auth->messages());
redirect('auth', 'refresh');
}
else
{ //if the login was un-successful
//redirect them back to the login page
$this->session->set_flashdata('message', $this->ion_auth->errors());
redirect('auth/login', 'refresh'); //use redirects instead of loading views for compatibility with MY_Controller libraries
}
}
else
{ //the user is not logging in so display the login page
//set the flash data error message if there is one
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
$this->data['email'] = array('name' => 'email',
'id' => 'email',
'type' => 'text',
'value' => $this->form_validation->set_value('email'),
);
$this->data['password'] = array('name' => 'password',
'id' => 'password',
'type' => 'password',
);
$this->load->view('auth/login', $this->data);
Here is the login in php(this works)
Code:
<div class='mainInfo'>
<div class="pageTitle">Login</div>
<div class="pageTitleBorder"></div>
<p>Please login with your email address and password below.</p>
<div id="infoMessage"><?php echo $message;?></div>
<?php echo form_open("auth/login");?>
<p>
<label for="email">Email:</label>
<?php echo form_input($email);?>
</p>
<p>
<label for="password">Password:</label>
<?php echo form_input($password);?>
</p>
<p>
<label for="remember">Remember Me:</label>
<?php echo form_checkbox('remember', '1', FALSE);?>
</p>
<p><?php echo form_submit('submit', 'Login');?></p>
<?php echo form_close();?>
</div>
And here is the code i wrote in html:
Code:
<?php
include('inc/inc-html-admin-start.php');
?>
<a name="anchorContent"></a>
<div id="content" class="adminLogin">
<h1>Anmeldung</h1>
<form action="auth/login/" method="post">
<fieldset>
<label for="email">Emailadresse:</label>
<input type="text" id="email" name="email" value="" class="inputText" />
</fieldset>
<fieldset>
<label for="password">Passwort:</label>
<input type="password" id="password" name="password" value="" class="inputText" />
</fieldset>
<fieldset>
<input type="submit" id="login" name="login" value="Anmelden" />
</fieldset>
</form>
</div>
</div>
<?php
include('inc/inc-html-admin-end.php');
?>
But when i submit i get redirected to the page and NOT logged in
any1 got an idea?
best regards