本文整理汇总了PHP中LoginForm类的典型用法代码示例。如果您正苦于以下问题:PHP LoginForm类的具体用法?PHP LoginForm怎么用?PHP LoginForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoginForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionLogin
public function actionLogin()
{
$formLogin = new LoginForm();
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
var_dump($_POST);
die;
echo CActiveForm::validate($model);
Yii::app()->end();
}
if (isset($_POST['LoginForm'])) {
$formLogin->attributes = $_POST['LoginForm'];
if ($formLogin->validate() && $formLogin->login()) {
$idSesion = Yii::app()->user->id;
$objusuario = new Usuarios();
$usuario = $objusuario->findByPk($idSesion);
switch ($usuario->roles_id) {
case '1':
# Redirecciona al perfil del Usuario registrado
break;
case '2' or '3':
$this->redirect(array('propuestas/listar'));
break;
default:
$this->redirect(array('site/login'));
break;
}
}
}
$this->render('login', array('model' => $formLogin));
}
开发者ID:Telemedellin,项目名称:directorioartistas,代码行数:30,代码来源:SiteController.php
示例2: actionLogin
/**
* This is the action to handle external exceptions.
*/
public function actionLogin()
{
if (!Yii::app()->user->isGuest) {
$this->redirect('/member/index.html');
}
$this->pageTitle = "登录中心 - " . Yii::app()->name;
if (isset($_POST['username'])) {
$status = array();
if (!isset($_POST['username']) || !isset($_POST['password'])) {
$status = array('status' => 0, "info" => '用户名或者密码错误!');
} else {
Yii::import("application.models.form.LoginForm", true);
$loginform = new LoginForm();
if (!isset($_POST['rememberMe'])) {
$_POST['rememberMe'] = false;
}
$loginform->setAttributes(array('username' => $_POST['username'], 'password' => $_POST['password'], 'rememberMe' => $_POST['rememberMe']));
if ($loginform->validate() && $loginform->login()) {
$status = array('status' => 1, "info" => '登录');
} else {
$status = array('status' => 0, "info" => '用户名或者密码错误!');
}
}
echo json_encode($status);
Yii::app()->end();
}
$this->render('html5_login');
}
开发者ID:bfyang5130,项目名称:zzl,代码行数:31,代码来源:UserController.php
示例3: run
public function run()
{
if (Yii::app()->user->isAuthenticated()) {
$this->controller->redirect(Url::redirectUrl(Yii::app()->getUser()->getReturnUrl()));
}
/**
* Если было совершено больше 3х попыток входа
* в систему, используем сценарий с капчей:
**/
$badLoginCount = Yii::app()->authenticationManager->getBadLoginCount(Yii::app()->getUser());
$module = Yii::app()->getModule('user');
$scenario = $badLoginCount > (int) $module->badLoginCount ? LoginForm::LOGIN_LIMIT_SCENARIO : '';
$form = new LoginForm($scenario);
if (Yii::app()->getRequest()->getIsPostRequest() && !empty($_POST['LoginForm'])) {
$form->setAttributes(Yii::app()->getRequest()->getPost('LoginForm'));
if ($form->validate() && Yii::app()->authenticationManager->login($form, Yii::app()->getUser(), Yii::app()->getRequest())) {
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('UserModule.user', 'You authorized successfully!'));
if (Yii::app()->getUser()->isSuperUser() && $module->loginAdminSuccess) {
$redirect = $module->loginAdminSuccess;
} else {
$redirect = empty($module->loginSuccess) ? Yii::app()->getBaseUrl() : $module->loginSuccess;
}
$redirect = Yii::app()->getUser()->getReturnUrl($redirect);
Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->getUser(), 0);
$this->controller->redirect(Url::redirectUrl($redirect));
} else {
$form->addError('email', Yii::t('UserModule.user', 'Email or password was typed wrong!'));
Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->getUser(), $badLoginCount + 1);
}
}
$this->controller->render($this->id, array('model' => $form));
}
开发者ID:sepaker,项目名称:yupe,代码行数:32,代码来源:LoginAction.php
示例4: execute
/**
* Executes the log-in attempt using the parameters passed. If
* the log-in succeeeds, it attaches a cookie to the session
* and outputs the user id, username, and session token. If a
* log-in fails, as the result of a bad password, a nonexistant
* user, or any other reason, the host is cached with an expiry
* and no log-in attempts will be accepted until that expiry
* is reached. The expiry is $this->mLoginThrottle.
*
* @access public
*/
public function execute()
{
$name = $password = $domain = null;
extract($this->extractRequestParams());
$result = array();
// Make sure noone is trying to guess the password brut-force
$nextLoginIn = $this->getNextLoginTimeout();
if ($nextLoginIn > 0) {
$result['result'] = 'NeedToWait';
$result['details'] = "Please wait {$nextLoginIn} seconds before next log-in attempt";
$result['wait'] = $nextLoginIn;
$this->getResult()->addValue(null, 'login', $result);
return;
}
$params = new FauxRequest(array('wpName' => $name, 'wpPassword' => $password, 'wpDomain' => $domain, 'wpRemember' => ''));
// Init session if necessary
if (session_id() == '') {
wfSetupSession();
}
$loginForm = new LoginForm($params);
switch ($loginForm->authenticateUserData()) {
case LoginForm::SUCCESS:
global $wgUser, $wgCookiePrefix;
$wgUser->setOption('rememberpassword', 1);
$wgUser->setCookies();
$result['result'] = 'Success';
$result['lguserid'] = $_SESSION['wsUserID'];
$result['lgusername'] = $_SESSION['wsUserName'];
$result['lgtoken'] = $_SESSION['wsToken'];
$result['cookieprefix'] = $wgCookiePrefix;
$result['sessionid'] = session_id();
break;
case LoginForm::NO_NAME:
$result['result'] = 'NoName';
break;
case LoginForm::ILLEGAL:
$result['result'] = 'Illegal';
break;
case LoginForm::WRONG_PLUGIN_PASS:
$result['result'] = 'WrongPluginPass';
break;
case LoginForm::NOT_EXISTS:
$result['result'] = 'NotExists';
break;
case LoginForm::WRONG_PASS:
$result['result'] = 'WrongPass';
break;
case LoginForm::EMPTY_PASS:
$result['result'] = 'EmptyPass';
break;
default:
ApiBase::dieDebug(__METHOD__, 'Unhandled case value');
}
if ($result['result'] != 'Success') {
$result['wait'] = $this->cacheBadLogin();
$result['details'] = "Please wait " . self::THROTTLE_TIME . " seconds before next log-in attempt";
}
// if we were allowed to try to login, memcache is fine
$this->getResult()->addValue(null, 'login', $result);
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:71,代码来源:ApiLogin.php
示例5: initialize
public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
{
parent::initialize($dispatcher, $storage, $options);
$env = sfContext::getInstance()->getConfiguration()->getEnvironment();
if ($env != 'test') {
$this->checkPermissions();
$this->resetPasswordCheck();
// here?
$this->checkDatabase();
$this->checkHtaccess();
$this->performTests();
}
$request = sfContext::getInstance()->getRequest();
if (!$this->isAuthenticated()) {
if ($request->getPostParameter('password') == '' && $request->getCookie($this->cookie_name) != '' && $request->getMethod() != sfRequest::POST) {
$params = array();
$params['password'] = $request->getCookie($this->cookie_name);
$form = new LoginForm($this, true, array(), array(), false);
// no csrf
$form->bind($params);
if ($form->isValid()) {
$this->setAuthenticated(true);
}
}
}
}
开发者ID:WIZARDISHUNGRY,项目名称:sflimetracker,代码行数:26,代码来源:trackerUser.class.php
示例6: executeDologin
public function executeDologin(sfWebRequest $request)
{
$form = new LoginForm();
$form->bind($this->getRequestParameter('credentials'));
if ($form->isValid()) {
$credentials = $request->getParameter('credentials');
$login = $credentials['login'];
$user = UserTable::getUserFromLogin($login);
## Store array of allowed sectionIds that can be accessed!
$sectionIdsArray = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($user->getDepartmentId());
// set the session correctly
$this->getUser()->setAuthenticated(true);
$this->getUser()->setAttribute('userId', $user->getId());
$this->getUser()->setAttribute('departmentId', $user->getDepartmentId());
$this->getUser()->setAttribute('departmentName', $user->getDepartment());
$this->getUser()->setAttribute('sectionIds', array_keys($sectionIdsArray));
$this->getUser()->setAttribute('credential', $user->getPrivilege());
##Do Logging!!
$newLog = new AuditLog();
$action = 'User has logged into Student Record Management System';
$newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
$this->getUser()->setFlash('notice', 'Welcome' . ' ' . $user->getFirstName());
//$this->redirect('filter/show?id='.$user->getId());
$this->redirect('programsection/index');
} else {
// give the form again
$this->form = $form;
$this->setTemplate('login');
}
}
开发者ID:eyumay,项目名称:srms.psco,代码行数:30,代码来源:actions.class.php
示例7: execute
public function execute($par)
{
global $wgUser, $wgCommandLineMode, $wgLang, $wgOut, $wrAdminUserName;
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if ($wgUser->isLoggedIn()) {
if ($wgUser->getName() == $wrAdminUserName) {
$user = User::newFromName($par);
} else {
$user = $wgUser;
}
$msg = '';
if ($user->getID() > 0) {
$user->setOption('enotifwatchlistpages', 0);
$user->setOption('enotifusertalkpages', 0);
$user->setOption('enotifminoredits', 0);
$user->setOption('disablemail', 1);
$user->saveSettings();
} else {
$msg = $user->getName() . ' not found';
}
$this->show($msg);
} else {
if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
User::SetupSession();
}
$request = new FauxRequest(array('returnto' => $wgLang->specialPage('Unsubscribe')));
require_once 'includes/SpecialUserlogin.php';
$form = new LoginForm($request);
$form->mainLoginForm("You need to log in to unsubscribe<br/><br/>", '');
}
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:34,代码来源:SpecialUnsubscribe.php
示例8: loginAction
public function loginAction()
{
$form = new LoginForm();
$request = $this->getRequest();
if ($request->isPost() && $request->getPost('login') == 'Login') {
$post = $request->getPost();
if ($form->isValid($post)) {
$result = $this->_user->login($post['user'], $post['password']);
//print_r($result);
switch ($result) {
case User::OK:
$this->view->loginMsg = self::LOG_OK;
$this->_redirect('/');
break;
case User::BAD:
$this->view->loginMsg = self::LOG_BAD;
break;
case User::BLOCK:
$this->view->loginMsg = self::LOG_BLOCK;
break;
}
}
}
$this->view->form = $form;
}
开发者ID:reveil,项目名称:CodeTornado,代码行数:25,代码来源:UserController.php
示例9: actionindex
/**
* Login action
*/
public function actionindex()
{
$model = new LoginForm();
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
if ($model->validate()) {
// Login
$identity = new InternalIdentity($model->email, $model->password);
if ($identity->authenticate()) {
// Member authenticated, Login
Yii::app()->user->setFlash('success', Yii::t('login', 'Thanks. You are now logged in.'));
Yii::app()->user->login($identity, Yii::app()->params['loggedInDays'] * 60 * 60 * 24);
}
// Redirect
$this->redirect('index/index');
}
}
// Load facebook
Yii::import('ext.facebook.facebookLib');
$facebook = new facebookLib(array('appId' => Yii::app()->params['facebookappid'], 'secret' => Yii::app()->params['facebookapisecret'], 'cookie' => true, 'disableSSLCheck' => false));
facebookLib::$CURL_OPTS[CURLOPT_CAINFO] = Yii::getPathOfAlias('ext.facebook') . '/ca-bundle.crt';
// Facebook link
$facebookLink = $facebook->getLoginUrl(array('req_perms' => 'read_stream,email,offline_access', 'next' => Yii::app()->createAbsoluteUrl('/login/facebooklogin', array('lang' => false)), 'display' => 'popup'));
$this->render('index', array('model' => $model, 'facebookLink' => $facebookLink, 'facebook' => $facebook));
}
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:28,代码来源:LoginController.php
示例10: actionLogout
public function actionLogout()
{
$actionFirst = Yii::app()->user->actionFirst;
if ($actionFirst == 'admin') {
$linkFirst = Yii::app()->user->linkFirst;
$username = Yii::app()->user->usernameFirst;
$password = Yii::app()->user->passwordFirst;
$this->f_logout();
$model = new LoginForm();
$model->username = $username;
$model->password = $password;
$model->linkFirst = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
$model->actionFirst = null;
$model->usernameFirst = null;
$model->passwordFirst = null;
$model->flagStoreLogin = null;
if ($model->loginWithRole()) {
if ($linkFirst != null) {
$this->redirect($linkFirst);
} else {
$this->redirect(array('store/index'));
}
} else {
$this->redirect(array('site/login'));
}
}
$this->redirect(Yii::app()->baseUrl . '/admin/site/logout');
}
开发者ID:hson91,项目名称:posnail,代码行数:28,代码来源:StoreController.php
示例11: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
$model = new LoginForm();
// if it is ajax validation request
/*
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
/* Simpan theme ke cookies */
$user = User::model()->findByPk(Yii::app()->user->id);
$theme = Theme::model()->findByPk($user->theme_id);
$theme->toCookies();
$this->redirect(Yii::app()->user->returnUrl);
}
}
// display the login form
$this->render('login', array('model' => $model));
}
开发者ID:AbuMuhammad,项目名称:ap3,代码行数:28,代码来源:AppController.php
示例12: actionLogin
/**
* Displays the login page
*/
public function actionLogin()
{
if (isset($_REQUEST['email'])) {
$model = new LoginForm();
// echo $_REQUEST['email']."<br>";
// echo $_REQUEST['password']."<br>";
$model->username = $_REQUEST['email'];
$model->password = $_REQUEST['password'];
// validate user input and redirect to the previous page if valid
if ($model->validate() && $model->login()) {
$user = User::model()->findByPk(Yii::app()->user->id);
$user->last_login = date('Y-m-d h:i:s');
$user->scenario = 'login';
if ($user->save()) {
echo $user->level;
} else {
print_r($user->getErrors());
}
// echo "succesfull";
} else {
echo "failed";
// print_r($model->getErrors());
}
} else {
echo "ga post ke login form";
}
}
开发者ID:Dvionst,项目名称:vvfy,代码行数:30,代码来源:SiteController.php
示例13: actionLogin
public function actionLogin()
{
//echo 'Yuan want to login system!';
//通过控制器来调用视图
//renderPartial()调用视图,不渲染布局,render可以
//$this->renderPartial('login');
if (!Yii::app()->user->isGuest) {
$this->redirect(array('user/home', 'uid' => Yii::app()->user->id));
}
//创建登录模型对象
$user_login = new LoginForm();
if (isset($_POST['LoginForm'])) {
//收集登录表单信息
$user_login->attributes = $_POST['LoginForm'];
//持久化用户信息 session,login()方法
//校验通过 validate()方法
if ($user_login->validate() && $user_login->login()) {
//$this->redirect(Yii::app()->user->returnUrl);//session 储存,开始
//$this->redirect("./index.php?r=user/home&id=$id");
//$this->redirect(Yii::app()->request->urlReferrer);
$this->redirect(array('user/home', 'uid' => Yii::app()->user->id));
}
}
$this->render('login', array('user_login' => $user_login));
}
开发者ID:SallyU,项目名称:footprints,代码行数:25,代码来源:UserController.php
示例14: run
public function run()
{
if (Yii::app()->user->isAuthenticated()) {
$this->controller->redirect(Yii::app()->user->returnUrl);
}
/**
* Если было совершено больше 3х попыток входа
* в систему, используем сценарий с капчей:
**/
$badLoginCount = Yii::app()->authenticationManager->getBadLoginCount(Yii::app()->user);
//@TODO 3 вынести в настройки модуля
$scenario = $badLoginCount > 3 ? 'loginLimit' : '';
$form = new LoginForm($scenario);
$module = Yii::app()->getModule('user');
if (Yii::app()->getRequest()->getIsPostRequest() && !empty($_POST['LoginForm'])) {
$form->setAttributes(Yii::app()->request->getPost('LoginForm'));
if ($form->validate() && Yii::app()->authenticationManager->login($form, Yii::app()->user, Yii::app()->request)) {
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('UserModule.user', 'You authorized successfully!'));
$module->onSuccessLogin(new CModelEvent($this->controller, array('loginForm' => $form)));
if (Yii::app()->user->isSuperUser() && $module->loginAdminSuccess) {
$redirect = array($module->loginAdminSuccess);
} else {
$redirect = empty($module->loginSuccess) ? Yii::app()->baseUrl : $module->loginSuccess;
}
Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->user, 0);
$this->controller->redirect($redirect);
} else {
$form->addError('hash', Yii::t('UserModule.user', 'Email or password was typed wrong!'));
Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->user, $badLoginCount + 1);
$module->onErrorLogin(new CModelEvent($this->controller, array('loginForm' => $form)));
}
}
$this->controller->render($this->id, array('model' => $form));
}
开发者ID:sherifflight,项目名称:yupe,代码行数:34,代码来源:LoginAction.php
示例15: actionAutenticar
/**
* Visualiza la pagina de autenticacion de usuario
*/
public function actionAutenticar()
{
$this->showSeeker = true;
$model = new LoginForm();
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
if ($model->validate()) {
if (Yii::app()->session[Yii::app()->params->sesion['redireccionAutenticacion']] == 'null') {
$this->redirect(Yii::app()->homeUrl);
} else {
$redirect = Yii::app()->session[Yii::app()->params->sesion['redireccionAutenticacion']];
Yii::app()->session[Yii::app()->params->sesion['redireccionAutenticacion']] = 'null';
$this->redirect($redirect);
}
//echo "--URL: " . Yii::app()->request->urlReferrer;
//$this->redirect(Yii::app()->request->urlReferrer);
//$this->redirect(Yii::app()->user->returnUrl);
}
} else {
if (!isset(Yii::app()->session[Yii::app()->params->sesion['redireccionAutenticacion']]) || Yii::app()->session[Yii::app()->params->sesion['redireccionAutenticacion']] == 'null') {
Yii::app()->session[Yii::app()->params->sesion['redireccionAutenticacion']] = Yii::app()->request->urlReferrer == null ? 'null' : Yii::app()->request->urlReferrer;
}
}
$this->render('autenticar', array('model' => $model));
}
开发者ID:JeffreyMartinezEiso,项目名称:lrv,代码行数:28,代码来源:UsuarioController.php
示例16: execute
public function execute($request)
{
if ($request->isMethod(sfWebRequest::POST)) {
$loginForm = new LoginForm();
$csrfToken = $request->getParameter('_csrf_token');
if ($csrfToken != $loginForm->getCSRFToken()) {
$this->getUser()->setFlash('message', __('Csrf token validation failed'), true);
$this->forward('auth', 'retryLogin');
}
$username = $request->getParameter('txtUsername');
$password = $request->getParameter('txtPassword');
$additionalData = array('timeZoneOffset' => $request->getParameter('hdnUserTimeZoneOffset', 0));
try {
$success = $this->getAuthenticationService()->setCredentials($username, $password, $additionalData);
if ($success) {
$this->getBeaconCommunicationService()->setBeaconActivation();
$this->getLoginService()->addLogin();
$this->redirect($this->getHomePageService()->getPathAfterLoggingIn($this->getContext()));
} else {
$this->getUser()->setFlash('message', __('Invalid credentials'), true);
$this->forward('auth', 'retryLogin');
}
} catch (AuthenticationServiceException $e) {
$this->getUser()->setFlash('message', $e->getMessage(), false);
$this->forward('auth', 'login');
}
}
return sfView::NONE;
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:29,代码来源:validateCredentialsAction.class.php
示例17: actionRegister
public function actionRegister()
{
$model = new User('register');
$provinces = Province::model()->findAll();
$provinces = CHtml::listData($provinces, 'idProvince', 'name');
$cities = array();
$districts = array();
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
if ($model->createUser()) {
//Log in the new user
$modelLoginForm = new LoginForm();
$modelLoginForm->username = $model->username;
$modelLoginForm->password = $model->conf_password;
//because password has been md5
if ($modelLoginForm->login()) {
$this->redirect(Yii::app()->user->returnUrl);
}
}
if (isset($model->idProvince)) {
$cities = City::model()->findAllByAttributes(array('idProvince' => $model->idProvince));
$cities = CHtml::listData($cities, 'idCity', 'name');
}
if (isset($model->idCity)) {
$districts = District::model()->findAllByAttributes(array('idCity' => $model->idCity));
$districts = CHtml::listData($districts, 'idDistrict', 'name');
}
}
$this->render('register', array('model' => $model, 'provinces' => $provinces, 'cities' => $cities, 'districts' => $districts));
}
开发者ID:rikohz,项目名称:Project1,代码行数:30,代码来源:UserController.php
示例18: execute
public function execute($par)
{
global $wgUser, $wgCommandLineMode, $wgLang, $wgOut, $wrAdminUserName;
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if ($wgUser->isLoggedIn() && $wgUser->getName() == $wrAdminUserName) {
$pieces = explode('/', $par);
if (count($pieces) > 1 && strlen($pieces[1]) == 8) {
$pieces[1] .= '000000';
}
$user = User::newFromName($pieces[0]);
$msg = '';
if (count($pieces) == 2 && $user->getID() > 0 && strlen($pieces[1]) == 14) {
$user->setOption('wrnoads', $pieces[1]);
$user->saveSettings();
} else {
$msg = $pieces[0] . ' not found or date incorrect';
}
$this->show($msg);
} else {
if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
User::SetupSession();
}
$request = new FauxRequest(array('returnto' => $wgLang->specialPage('NoAds')));
$form = new LoginForm($request);
$form->mainLoginForm("You need to log in<br/><br/>", '');
}
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:30,代码来源:SpecialNoAds.php
示例19: renderContent
public function renderContent()
{
if (Yii::app()->user->isMember) {
$this->render('bank');
} else {
$model = new LoginForm();
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
// validate user input and redirect to the previous page if valid
//if($model->validate() && $model->login())
if ($model->validate()) {
switch (Yii::app()->user->role_id) {
case ROLE_MEMBER:
Yii::app()->controller->redirect(Yii::app()->createAbsoluteUrl('member'));
break;
case ROLE_ADMIN:
Yii::app()->controller->redirect(Yii::app()->createAbsoluteUrl('admin/login'));
break;
default:
Yii::app()->controller->redirect(Yii::app()->createAbsoluteUrl('member'));
}
Yii::app()->end();
}
}
// display the login form
$this->render('form', array('model' => $model));
}
}
开发者ID:jasonhai,项目名称:onehome,代码行数:29,代码来源:LoginFormWid.php
示例20: actionSignup
public function actionSignup()
{
$model = new User();
// uncomment the following code to enable ajax-based validation
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='user-signup-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
if ($model->validate()) {
$login = new LoginForm();
$login->username = $model->email;
$login->password = $model->password;
$model->save(false);
if ($login->validate(array('username', 'password')) && $login->login()) {
$this->redirect(Yii::app()->user->returnUrl);
} else {
echo "Email:" . $model->email;
echo "Password:" . $model->password;
$this->render('login', array('model' => $login));
return;
}
// form inputs are valid, do something here
}
}
$this->render('signup', array('model' => $model));
}
开发者ID:anmolview,项目名称:yiidemos,代码行数:31,代码来源:SiteController.php
注:本文中的LoginForm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论