Drupal中自定义登录页面
通过覆写template定义新的user_login表单来为自定义登录页面。
方法:
1. 本站使用的主题是Rorty。来到\sites\all\themes\rorty,打开template.php,添加代码。目的是为登录页面指定一个新的模版,路径是templates/user/user_login,渲染类 型是form表单
function rorty_theme(&$existing, $type, $theme, $path) {
$hooks['user_login'] = array(
'template' => 'templates/user/user_login',
'render element' => 'form',
);
// $hooks['user_register_form'] = array(
// 'template' => 'templates/user/user_register',
// 'render element' => 'form',
// );
return $hooks;
}
2. 根据'template'参数路径,在templates目录下建立user\user_login.tpl.php文件。
3. 仿照之前的登录页面。重写代码。比如再写form标签了。
<div class="form-item form-type-textfield form-item-name">
<label for="edit-name">Username <span class="form-required" title="This field is required.">*</span></label>
<input type="text" id="edit-name" name="name" value="" size="60" maxlength="60" class="form-text required">
<div class="description">Enter your Rorty username.</div>
</div> <div class="form-item form-type-password form-item-pass">
<label for="edit-pass">Password <span class="form-required" title="This field is required.">*</span></label>
<input type="password" id="edit-pass" name="pass" size="60" maxlength="128" class="form-text required">
<div class="description">Enter the password that accompanies your username.</div>
</div> <?php print drupal_render($form['form_id']); ?>
<?php print drupal_render($form['locale']); ?>
<?php print drupal_render($form['honeypot_time']); ?> <div class="form-actions form-wrapper" id="edit-actions">
<input type="submit" id="edit-submit" name="op" value="Log in" class="form-submit" />
<input type="button" name="op2" value="Register" class="form-submit" onclick="location.href='user/register'"/>
</div>
4. 清空缓存。重新来到登录页面www.xxx.com/user/login,查看效果。
Drupal中自定义登录页面的更多相关文章
- 为SharePoint 2010中的FBA创建自定义登录页面
SharePoint 2010中默认的FBA登录页面非常简单,只提供了一个Asp.Net的Login控件,让用户输入用户名和密码.在大多数情况下,我们需要定制这个页面以满足一些安全需求,比如为登录页面 ...
- spring security动态管理资源结合自定义登录页面
如果想将动态管理资源与自定义登录页面一起使用,最简单的办法就是在数据库中将登录页面对应的权限设置为IS_AUTHENTICATED_ANONYMOUSLY. 因此在数据库中添加一条资源信息. INSE ...
- CAS 4.0.x 自定义登录页面
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] CAS默认登录页面 复制一个新的页面管理页面 修改页面引用 修改casproperties 修改casLoginViewjs ...
- (二)spring Security 自定义登录页面与校验用户
文章目录 配置 security 配置下 MVC 自定义登录页面 自定义一个登陆成功欢迎页面 效果图 小结: 使用 Spring Boot 的快速创建项目功能,勾选上本篇博客需要的功能:web,sec ...
- Spring MVC 项目搭建 -4- spring security-添加自定义登录页面
Spring MVC 项目搭建 -4- spring security-添加自定义登录页面 修改配置文件 <!--spring-sample-security.xml--> <!-- ...
- Spring security 知识笔记【自定义登录页面】
一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...
- Spring Security 自定义登录页面
SpringMVC + Spring Security,自定义登录页面登录验证 学习参考:http://www.mkyong.com/spring-security/spring-security-f ...
- MVC4.0 使用Form认证,自定义登录页面路径Account/Login
使用MVC4.0的时候,一般遇到会员登录.注册功能,我们都会使用Form认证,给需要身份验证的Action进行授权(需要登录后才能访问的Action添加[Authorize]属性标签),登录.注册的时 ...
- Springsecurity搭建自定义登录页面
1.springSecurity的搭建 新建一个springboot的web项目,我这边只选中了web,建立后如下: pom依赖: <!-- https://mvnrepository.com/ ...
随机推荐
- codeforces 848B Rooter's Song
题目链接 正解:排序+模拟. 我们注意到两个点碰撞的必要条件,$pi+tj=pj+ti$,移项以后发现就是$pi-ti=pj-tj$,那么我们可以把$p-t$相同的点分为同一组. 然后我们还可以发现一 ...
- BIND简易教程(1):安装及基本配置
首先,为什么说是简易教程呢?因为BIND的功能实在太多,全写出来的话要连载好久,我觉得我没有那么多精力去写:而我了解的仅仅是有限的一点点,不敢造次.百度上的文章也是一抓一大把呐!所以,教点基本使用方法 ...
- 系统监控zabbix
zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统 ...
- Google 和 Baidu 常用的搜索技巧
Google 常用的搜索技巧 1. 精确搜索:双引号 精确搜索,就是在你要搜索的词上,加上双引号,这个Google搜索引擎,就会完全的匹配你所要的词 2. 站内搜索:site 这是一个比较常用的搜索方 ...
- SignalR 教程一
转帖官方教程:Tutorial: Getting Started with SignalR 2 and MVC 5 http://www.asp.net/signalr/overview/gettin ...
- .NET 中 如果一个Task A正在await另一个Task B,那么Task A是什么状态
新建一个.NET Core控制台程序,输入如下代码: using System; using System.Threading; using System.Threading.Tasks; class ...
- win7利用winSCP上传文件到ubuntu server
1.为ubuntu server设置root密码: sudo passwd root 先设密码在登录 2. su root进入root账户: 3.安装SSH:sudo apt-get install ...
- 撸一个简单的MVVM例子
我个人以为mvvm框架里面最重要的一点就是VM这部分,它要与Model层建立联系,将Model层转换成可以被View层识别的数据结构:其次也要同View建立联系,将数据及时更新到View层上,并且响应 ...
- Knowledge Point 20180305 详解精度问题
1.1 精度与基本数据类型运算的深度解析 我们在探讨Java基本数据类型时多次提到过精度的问题,那么计算机中的精度究竟是什么样的,为什么我们有时候的计算和我们预期的不同呢?下面我们通过精度来了解: 1 ...
- 使用 Solr 构建企业级搜索服务器
最近因项目需要一个全文搜索引擎服务, 在考察了Lucene及Solr后,我们选择了Solr. 本文简要记录了基于Solr搭建一个企业搜索服务器的过程.网上的资料太多千篇一律,也可能版本不同,总之在参照 ...