CREATE OR REPLACE PROCEDURE Forgot_Grader_Passwd AS
begin
   htp.htmlOpen;
   htp.headOpen;
   htp.title('Forgot Password');
   htp.headClose;
   htp.bodyOpen('/ows-img/raj/fleck.jpg');
   htp.centerOpen;
   htp.formOpen(owa_util.get_owa_service_path ||
                'Retrieve_Grader_Passwd', 'get'); 
       htp.print('<b>Enter your student ID<p>
	 <input type="text" name="ssn" size="15" maxlength="15"><p>');
       htp.print('<input type=Submit value="Submit">');
   htp.formClose;
   htp.centerClose;

   htp.bodyClose;
   htp.htmlClose;
    
end;
/
show errors


CREATE OR REPLACE PROCEDURE Retrieve_Grader_Passwd(
					   ssn    in varchar2 default null) AS
   no_ssn exception;
   passwd_buffer varchar2(15);
   userid_buffer varchar2(15);   
begin
   htp.htmlOpen;
   htp.headOpen;
   htp.title('Forgot Password');
   htp.headClose;
   htp.bodyOpen('/ows-img/raj/fleck.jpg');
   htp.centerOpen;
   if (ssn is null) then
     raise no_ssn;
   end if;
   
   select U.userID, U.password
   into   userid_buffer, passwd_buffer
   from   whoami U
   where  U.sid = ssn;

   htp.print('<font color="purple" face="Comic Sans MS"size="2">
	     Your userid is <font color=red>' || userid_buffer||'</font><br>');
   htp.print('<font color="purple" face="Comic Sans MS"size="2">
	     Your password is <font color=red>' || passwd_buffer || '</font>');
     htp.para;
     htp.print('<form><input type=button value="Back" onClick="history.go(-1)"></form>');

   htp.centerClose;
   
   htp.bodyClose;
   htp.htmlClose;

   EXCEPTION
    WHEN NO_DATA_FOUND then
     htp.print('<font color="purple" face="Comic Sans MS" size="2">
		Your student ID '||htf.bold(ssn)||' is not in the database.</font><p>');
     htp.print('<form><input type=button value="Back" onClick="history.go(-1)"></form>');
    WHEN no_SSN then
     htp.print('<font color="purple" face="Comic Sans MS" size="2">
		Please enter your student ID</font><p>');
     htp.print('<form><input type=button value="Back" onClick="history.go(-1)"></form>');
end;
/
show errors


