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/ ...
随机推荐
- Struts2.3.4.1 + Spring3.1.2 + Hibernate4.1.6整合
1. Jar包 2. web.xml配置 3. struts.xml配置 4. hibernate.cfg.xml配置 5. applicationContext.xml配置 6. log4j.pro ...
- wampserver的安装与配置
一.安装:wamp的安装很简单,只需要按照提示并根据自己的需求操作即可,这里不再赘述. 二.配置:wamp安装完后,需进行如下配置才能正常工作. 1.修改MySQL的登录密码 (1)启动WampSer ...
- MyBatis(3)开发dao方法
本次全部学习内容:MyBatisLearning SqlSession SqlSession是一个面向用户(程序员)的接口. SqlSession中提供了很 ...
- Windows 2008 Scheduled tasks result codes
0 or 0x0: The operation completed successfully. 1 or 0x1: Incorrect function called or unknown funct ...
- Synchronized介绍
来源 https://www.imooc.com/learn/1086 作用 同步方法支持一种简单的策略来防止线程干扰和内存一致性错误,如果一个对象对多个线程可见,则对该对象变量的所有读取或写入都 ...
- springAOP(Aspect)权限访问页面
1.XML进行配置切面 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="h ...
- 关于readonly的一些说明
readonly在代码中只能在字段初始化器和构造函数中赋值,并不是说readonly只能赋值一次,超出这个范围以后readonly就不能通过代码修改了,但是还是可以用反射来修改,readonly仅仅是 ...
- 产线事故:删除创建mysql索引
单表数据量:670W: 删除一个老的索引,新建一个新的索引. 事故原因: 先删除索引,应用访问量大,没有索引自然慢,数据库CPU飚到100%:新索引创建失败. 直接造成交易打烊. 日志: ------ ...
- 如何搭建私人的ghost博客
可参考 http://blog.pandax.me/cjbk/ 此文
- 使用 Solr 构建企业级搜索服务器
最近因项目需要一个全文搜索引擎服务, 在考察了Lucene及Solr后,我们选择了Solr. 本文简要记录了基于Solr搭建一个企业搜索服务器的过程.网上的资料太多千篇一律,也可能版本不同,总之在参照 ...