通过覆写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中自定义登录页面的更多相关文章

  1. 为SharePoint 2010中的FBA创建自定义登录页面

    SharePoint 2010中默认的FBA登录页面非常简单,只提供了一个Asp.Net的Login控件,让用户输入用户名和密码.在大多数情况下,我们需要定制这个页面以满足一些安全需求,比如为登录页面 ...

  2. spring security动态管理资源结合自定义登录页面

    如果想将动态管理资源与自定义登录页面一起使用,最简单的办法就是在数据库中将登录页面对应的权限设置为IS_AUTHENTICATED_ANONYMOUSLY. 因此在数据库中添加一条资源信息. INSE ...

  3. CAS 4.0.x 自定义登录页面

    版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[-] CAS默认登录页面 复制一个新的页面管理页面 修改页面引用 修改casproperties 修改casLoginViewjs ...

  4. (二)spring Security 自定义登录页面与校验用户

    文章目录 配置 security 配置下 MVC 自定义登录页面 自定义一个登陆成功欢迎页面 效果图 小结: 使用 Spring Boot 的快速创建项目功能,勾选上本篇博客需要的功能:web,sec ...

  5. Spring MVC 项目搭建 -4- spring security-添加自定义登录页面

    Spring MVC 项目搭建 -4- spring security-添加自定义登录页面 修改配置文件 <!--spring-sample-security.xml--> <!-- ...

  6. Spring security 知识笔记【自定义登录页面】

    一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  7. Spring Security 自定义登录页面

    SpringMVC + Spring Security,自定义登录页面登录验证 学习参考:http://www.mkyong.com/spring-security/spring-security-f ...

  8. MVC4.0 使用Form认证,自定义登录页面路径Account/Login

    使用MVC4.0的时候,一般遇到会员登录.注册功能,我们都会使用Form认证,给需要身份验证的Action进行授权(需要登录后才能访问的Action添加[Authorize]属性标签),登录.注册的时 ...

  9. Springsecurity搭建自定义登录页面

    1.springSecurity的搭建 新建一个springboot的web项目,我这边只选中了web,建立后如下: pom依赖: <!-- https://mvnrepository.com/ ...

随机推荐

  1. Ajax三级联动操作的js代码

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  2. Python常用库之一:Numpy

    Numpy支持大量的维度数组和矩阵运算,对数组运算提供了大量的数学函数库! Numpy比Python列表更具优势,其中一个优势便是速度.在对大型数组执行操作时,Numpy的速度比Python列表的速度 ...

  3. 4springboot:日志(上)

    1.主流的日志框架 2.SLF4J使用 如何在系统中使用SLF4j https://www.slf4j.org 以后开发的时候,日志记录方法的调用,不应该来直接调用日志的实现类,而是调用日志抽象层里面 ...

  4. 2018.12.31 Failed to load JavaHL Library.错误解决

    创建项目出现下面的错误 Failed to load JavaHL Library. These are the errors that were encountered: no libsvnjava ...

  5. 安装jdk1.7

    1.压缩文件放到/usr文件夹里 2.解压到 /usr里,tar -zxvf jdk-7u71-linux-i586.tar.gz 3.配置jdk环境变量,打开/etc/profile配置文件,将下面 ...

  6. MyEclipse 远程调试Tomcat

    当Web项目部署在服务器之后,当项目出现问题的时候就需要远程调试[远程调试的代码要与本地代码一致] 配置远程调试的具体步骤如下: 1.Linux 中配置tomcat在catalina.sh中添加如下C ...

  7. 在spring添加注解时,第一行package报错configure build path

    练习spring的ioc的注解的时候写上注解就会在第一行package报错configure build path. 用的spring4.2.4的jar包.经过上网查阅资料,可能是jar包冲突,解决办 ...

  8. WebAPI 实现前后端分离的示例

    转自:http://www.aspku.com/kaifa/net/298780.html 随着Web技术的发展,现在各种框架,前端的,后端的,数不胜数.全栈工程师的压力越来越大. 现在的前端的框架, ...

  9. nopCommerce电子商务平台 安装教程(图文)

    nopCommerce是一个通用的电子商务平台,适合每个商家的需要:它强大的企业和小型企业网站遍布世界各地的公司销售实体和数字商品.nopCommerce是一个透明且结构良好的解决方案,它结合了开源和 ...

  10. Qt5连接Mysql环境配置

    已安装的环境:Mysql5.7 64bit ,Qt5.12 64bit. 到mysql官方下载mysql5.7 64bit的压缩包,解压,复制下图框内四个文件. 将四个文件复制到Qt安装目录下bin目 ...