Visualforce Page:
<apex:page controller="wavuhlogincls" showHeader="false">
<style>
.labelcls{color:white;font-weight:bold;font-size:30px;}
</style>
<apex:form >
<head>
<div style="background-color:#125AA4" id="div">
<table style="height:20px">
<tr>
<td >
<apex:outputLabel value="WavuH" style="color:white;font-weight:bold;font-family: Forte;font-size:30px;margin-left:250px;"></apex:outputLabel>
</td>
</tr>
</table>
</div></head>
<apex:pageblock rendered="{!logintable}">
<body>
<table width="100%" border="0" height="100%" >
<tr>
<td width="65%" style="padding-bottom:300px;">
<div > <apex:outputLabel style="color:#810988; margin-left:250px; font-size:20px ">
<h1>ERP made simple, affordable</h1>
</apex:outputLabel>
</div><br/>
<table border="0">
<tr>
<td>
<apex:image value="{!$Resource.crm}" style="margin-left:250px"/ >
<td style="padding-bottom:14px">
<apex:outputLabel value="CRM" style="font-weight:bold; margin-left:20px"/><br/>
<apex:outputLabel value="understand and manage your customers at a glance" style="margin-right:50px; margin-left:20px"/>
</td>
</td>
</tr>
</table>
<table border="0">
<tr>
<td>
<apex:image value="{!$Resource.hr}" style="margin-left:250px"/ >
<td style="padding-bottom:14px">
<apex:outputLabel value="HR" style="font-weight:bold; margin-left:20px"/><br/>
<apex:outputLabel value="manage and pay your staffers efficiently through payroll & HRM" style="margin-right:50px; margin-left:20px"/>
</td>
</td>
</tr>
</table>
<table border="0">
<tr>
<td>
<apex:image value="{!$Resource.financials}" style="margin-left:250px"/ >
<td style="padding-bottom:14px">
<apex:outputLabel value="Financials" style="font-weight:bold; margin-left:20px"/><br/>
<apex:outputLabel value="comprehensive accounting and statistics for your business" style="margin-right:50px; margin-left:20px"/>
</td>
</td>
</tr>
</table>
<table border="0">
<tr>
<td>
<apex:image value="{!$Resource.supplychain}" style="margin-left:250px"/ >
<td style="padding-bottom:14px">
<apex:outputLabel value="Supply Chain" style="font-weight:bold; margin-left:20px"/><br/>
<apex:outputLabel value="take control of your assets, inventory & procurement processes" style="margin-right:50px; margin-left:20px"/>
</td>
</td>
</tr>
</table> <br/>
<table>
<tr><td> <apex:outputlabel value="Don't hava a Wavuh Account?" style="margin-left:300px"/>
<apex:commandLink value="Get one here" style="color:blue" action="/apex/wavuhregistration"/></td></tr>
<tr><td style="padding-top:20px;">
<div align="center"><apex:commandlink value=" Login " action="{!loginpage}" style="color:blue;margin-left:300px"/>
<apex:commandlink value="Contact Us" action="{!contactus}" style="color:blue;"/></div></td></tr>
</table>
</td>
<td style="padding-top:70px">
<table border="1" height="250px" width="60%" style="margin-bottom:350px; border-color:blue; border-width:0px; border-bottom-width:1px" rules="cols" >
<tr>
<td height="40px" bgcolor="#115499"><apex:outputLabel value="Login" style="color:white; font-weight:bold; font-size:20px"/></td>
</tr>
<tr>
<td >
<div>
<apex:pagemessages ></apex:pagemessages>
<apex:outputLabel value="User Name" />
<apex:inputText style="margin-left:20px" value="{!uname}"/></div><br/>
<div>
<apex:outputLabel value="Password" />
<apex:inputText style="margin-left:25px" value="{!pwd}"/>
</div><br/>
<div><apex:commandButton value="Sign in" style="margin-left:150px" action="{!permitlogin}"/></div><br/><br/>
<div align="center"><apex:commandLink value="Forgot your Password?" style="color:red" action="{!forgotpwd}"/></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</apex:pageblock>
<!-- <apex:pageblock rendered="{!logintable}">
<table align="right" width="35%"><tr><td>
<div style="background-color:#125AA4">
<table style="height:10px">
<tr>
<td>
<apex:outputLabel value="Login" styleClass="labelcls"></apex:outputLabel>
</td>
</tr>
</table>
</div><br/>
<apex:pagemessages ></apex:pagemessages>
<apex:outputLabel value="User Name or Password does not match" rendered="{!show}" style="color:red"/>
<tr><td style="padding-top:20px"><div align="center">Username<apex:inputtext value="{!uname}"/></div></td></tr>
<tr><td style="padding-top:20px"><div align="center">Password<apex:inputsecret value="{!pwd}"/></div></td></tr>
<tr><td style="padding-top:20px"><div align="center"><apex:commandButton value="Signin" action="{!permitlogin}"/></div></td></tr>
<tr><td style="padding-top:20px"><div align="center"><apex:commandLink value="Forgot your Password?" style="color:red" action="{!forgotpwd}"/></div></td></tr>
</td></tr> </table><br/><br/>
<apex:outputlabel >Don't hava a Wavuh Account?</apex:outputlabel> <apex:commandLink value="Get one here" style="color:blue" action="/apex/wavuhregistration"/>
</apex:pageblock> -->
<apex:pageblock rendered="{!resetpwd}">
<br/>
<div align="center">
<apex:outputlabel style="font-size:13px;font-weight:bold">Kindly enter your email address below to send you a password</apex:outputlabel>
</div>
<br/>
<table align="center" border="1" height="20px" width="30%" style=" border-color:blue; border-width:0px; border-bottom-width:1px" rules="cols">
<tr><td>
<table style="background-color:#125AA4" width="100%">
<tr><td><apex:outputLabel value="Reset Password" style="color:white;font-weight:bold;font-size:20px;"></apex:outputLabel></td></tr>
</table>
</td></tr>
<tr><td>
<table align="center" width="100%">
<tr><td> <apex:pagemessages ></apex:pagemessages></td></tr>
<tr><td style="padding-top:20px"><div align="center">Email<apex:inputtext value="{!mailid}" /></div></td></tr>
<tr><td style="padding-top:20px"><div align="center"><apex:commandButton value="Send me Password" action="{!backtologin}"/></div></td></tr>
<tr><td style="padding-top:20px; padding-bottom:20px">
<div align="center"><apex:commandlink value=" Login " action="{!loginpage}" style="color:blue;"/>
<apex:commandlink value="Contact Us" action="{!contactus}" style="color:blue;"/></div></td></tr>
</table></td></tr></table>
</apex:pageblock>
<apex:pageBlock rendered="{!contactdetails}">
<table border="0" style="margin-left:250px">
<tr><td style="padding-bottom:40px;padding-top:25px">
<apex:outputLabel value="Contact Us" style="color:#E3170D;font-weight:bold;font-size:20px;"/>
</td></tr>
<tr><td>
<apex:outputLabel value="Main Office" style="font-size:15px;font-weight:bold;"/><br/><br/>
<apex:outputlabel value="5th Floor, Namdev Block"/><br/><br/>
<apex:outputlabel value="Prime Hospital Lane"/><br/><br/>
<apex:outputlabel value="S.r.Nagar"/><br/><br/>
<apex:outputlabel value="Phone:09440490498"/><br/><br/>
Email: <a href=" mailto:gaddam.narayana86@gmail.com" style="color:blue;">gaddam.narayana86@gmail.com</a>
</td></tr>
<tr><td style="padding-top:20px;">
<div align="center"><apex:commandlink value=" Login " action="{!loginpage}" style="color:blue"/>
<apex:commandlink value="Contact Us" action="{!contactus}" style="color:blue;"/></div></td></tr>
</table>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Class:
public with sharing class wavuhlogincls {
public boolean show { get; set; }
public string uname{get; set;}
public string pwd{get; set;}
public List<Registration1__c> reg{get; set;}
public PageReference permitlogin() {
reg=[select id,Name,gnr__Password__c,Email__c from Registration1__c];
for(Registration1__c r:reg){
if((uname==r.Name)&&(pwd==r.Password__c)){
pagereference newpage=page.wavuhmenu;
newpage.getparameters().put('my',uname);
return newpage;
}
if((uname!=r.Name)||(pwd!=r.Password__c)){
Apexpages.Message msg=new Apexpages.Message(Apexpages.severity.fatal,'User name or password does not match');
Apexpages.addmessage(msg);
// show=true;
}
}
return null;
}
public string mailid{get; set;}
string emailid;
public Registration1__c reg1{get; set;}
public PageReference backtologin() {
reg=[select id,Name,gnr__Password__c,Email__c from Registration1__c];
try{
if(mailid!=''){
if(mailid!=null)
reg1=[select id,Password__c,Email__c,name from Registration1__c where Email__c=:mailid];
emailid=reg1.Email__c;
Messaging.SingleEmailMessage msem= new Messaging.SingleEmailMessage();
msem.setToAddresses(new string[] {emailid});
msem.setSubject('Reset Password of your Wavuh Account');
msem.setHTMLBody('Username:'+reg1.Name+' and password:'+reg1.Password__c);
System.debug('------------------------------'+msem);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {msem});
Apexpages.Message msg=new Apexpages.Message(Apexpages.severity.info,'Password has been sent to '+mailid+' mail ID');
Apexpages.addmessage(msg);
}
else{
Apexpages.Message msg=new Apexpages.Message(Apexpages.severity.fatal,'Enter Email Address');
Apexpages.addmessage(msg);
}
}
catch(Exception e){
Apexpages.Message msg=new Apexpages.Message(Apexpages.severity.fatal,'Enter valid Email Address');
Apexpages.addmessage(msg);
}
return null;
}
public pagereference loginpage(){
resetpwd=false;
logintable=true;
contactdetails=false;
return null;
}
public boolean contactdetails{get; set;}
public pagereference contactus(){
logintable=false;
resetpwd=false;
contactdetails=true;
return null;
}
public PageReference forgotpwd() {
logintable=false;
resetpwd=true;
contactdetails=false;
return null;
}
public wavuhlogincls(){
logintable=true;
}
public boolean logintable { get; set; }
public boolean resetpwd { get; set; }
}
No comments:
Post a Comment