我想通过phonegap在Android上实现一个基于Codeigniter的应用程序,除了使用坦克认证登录/注销外,所有工作都很好。在Android上使用Codeigniter和坦克认证在phonegap上
当提交登录表单时,它会一直显示一个对话框,显示“完成操作使用”,并提供选择浏览器的选项,而不是留在应用程序窗口中。
如果你选择它再次打开登录页面浏览器窗口浏览器,但是如果应用程序重新启动它于二
登录我怎样才能阻止这种跳转到浏览器这样的应用程序是无缝?我认为这是坦克认证写/销毁cookie信息的时候。由于客户端主机不支持子域,因此它将在根目录下的/ android子文件夹中运行。
这是坦克auth登录代码。请注意,'家'是默认的控制器。
编辑:我实际上不需要接受'完成操作使用'对话框 - 如果我只是点击回来并重新启动它登录的应用程序!希望我能知道正在做一个对话框弹出,实际上,我非常深刻的印象,PhoneGap的已经成功地环绕一个完整的CI网站与所有的认证......
function login()
{
if ($this->tank_auth->is_logged_in()) { // logged in
redirect('home');
} elseif ($this->tank_auth->is_logged_in(FALSE)) { // logged in, not activated
redirect('/auth/send_again/');
} else {
$data['login_by_username'] = ($this->config->item('login_by_username', 'tank_auth') AND
$this->config->item('use_username', 'tank_auth'));
$data['login_by_email'] = $this->config->item('login_by_email', 'tank_auth');
$this->form_validation->set_rules('login', 'Login', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean');
$this->form_validation->set_rules('remember', 'Remember me', 'integer');
// Get login for counting attempts to login
if ($this->config->item('login_count_attempts', 'tank_auth') AND
($login = $this->input->post('login'))) {
$login = $this->security->xss_clean($login);
} else {
$login = '';
}
$data['use_recaptcha'] = $this->config->item('use_recaptcha', 'tank_auth');
if ($this->tank_auth->is_max_login_attempts_exceeded($login)) {
if ($data['use_recaptcha'])
$this->form_validation->set_rules('recaptcha_response_field', 'Confirmation Code', 'trim|xss_clean|required|callback__check_recaptcha');
else
$this->form_validation->set_rules('captcha', 'Confirmation Code', 'trim|xss_clean|required|callback__check_captcha');
}
$data['errors'] = array();
if ($this->form_validation->run()) { // validation ok
if ($this->tank_auth->login(
$this->form_validation->set_value('login'),
$this->form_validation->set_value('password'),
$this->form_validation->set_value('remember'),
$data['login_by_username'],
$data['login_by_email'])) { // success
$this->load->library('user_agent');
redirect('home'); // Adds this onto /android/
} else {
$errors = $this->tank_auth->get_error_message();
if (isset($errors['banned'])) { // banned user
$this->_show_message($this->lang->line('auth_message_banned').' '.$errors['banned']);
} elseif (isset($errors['not_activated'])) { // not activated user
redirect('/auth/send_again/');
} else { // fail
foreach ($errors as $k => $v) $data['errors'][$k] = $this->lang->line($v);
}
}
}
$data['show_captcha'] = FALSE;
if ($this->tank_auth->is_max_login_attempts_exceeded($login)) {
$data['show_captcha'] = TRUE;
if ($data['use_recaptcha']) {
$data['recaptcha_html'] = $this->_create_recaptcha();
} else {
$data['captcha_html'] = $this->_create_captcha();
}
}
$this->load->view('view_header');
$this->load->view('auth/login_form', $data);
}
}
谢谢 - 我在看ChildBrowser,但不知道是否有处理认证没有弹出窗口的方式... –