• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

檢核使用者密碼的程序 VRYUSRPWD

发布: 2007-6-08 22:43 | 作者: seanhe | 来源: | 查看: 23次 | 进入软件测试论坛讨论

领测软件测试网
檢核使用者密碼的程序 VRYUSRPWD   

檢核使用者密碼的程序 VRYUSRPWD 

File   : QRPGLESRC
Member : VRYUSRPWD
Type   : RPGLE

     
     *  ===================================================================
     *  = Service Program... VRYUSRPWD                                    =
     *  = Description....... Verify User Password                         =
     *  =                                                                 =
     *  = Compile........... CrtRPGMod Module(YourLib/VRYUSRPWD)          =
     *  =                              SrcFile(YourLib/YourSrcFile)       =
     *  ===================================================================

    H NoMain

     *  ===================================================================
     *  = Prototypes                                                      =
     *  ===================================================================

     *  -------------------------------------------------------------------
     *  - VfyUsrPwd - Veryify user password                               -
     *  -------------------------------------------------------------------

    D VfyUsrPwd       PR             1N
    D                               10    value
    D                               10    value
    D                              272    Options( *NoPass 

     *  -------------------------------------------------------------------
     *  - GetProfileHdl - Get profile handle API                          -
     *  -------------------------------------------------------------------

    D GetProfileHdl   PR                  ExtPgm( 'QSYGETPH' 
    D                               10
    D                               10
    D                               12
    D                              272

     *  -------------------------------------------------------------------
     *  - RlsProfileHdl - Release profile handle API                      -
     *  -------------------------------------------------------------------

    D RlsProfileHdl   PR                  ExtPgm( 'QSYRLSPH' 
    D                               12
    D                              272

     *  ===================================================================
     *  = Procedure..... VfyUsrPwd                                        =
     *  = Description... Verify user password                             =
     *  ===================================================================

    P VfyUsrPwd       B                   Export
    D                 PI             1N
    D  UsrPrf                       10    value
    D  Password                     10    value
    D  APIError                    272    Options( *NoPass 

     *  -------------------------------------------------------------------
     *  - Data definitions                                                -
     *  -------------------------------------------------------------------

    D  Hdl            S             12

    D NoAPIError      C                   Const( *Zero 
    D APIErrorPassed  S              1N

    D APIErrorDS      DS
    D  BytesProvided                10I 0 Inz( %Size( APIErrorDS  
    D  BytesAvail                   10I 0 Inz( *Zero 
    D  MsgID                         7    Inz( *Blanks 
    D  Reserved                      1    Inz( X'00' 
    D  MsgDta                      256    Inz( *Blanks 

     *  -------------------------------------------------------------------
     *  - Determine whether API error parameter was passed                -
     *  -------------------------------------------------------------------

    C                   If        %Parms > 2
    C                   Eval      APIErrorPassed = *On
    C                   EndIf

     *  -------------------------------------------------------------------
     *  - Retrieve profile handle                                         -
     *  -------------------------------------------------------------------

    C                   Reset                   APIErrorDS

    C                   CallP     GetProfileHdl(
    C                                            UsrPrf     :
    C                                            Password   :
    C                                            Hdl        :
    C                                            APIErrorDS
    C                                          

    C                   If        BytesAvail <> NoAPIError
    C                   ExSr      ReturnError
    C                   EndIf

     *  -------------------------------------------------------------------
     *  - Release profile handle                                          -
     *  -------------------------------------------------------------------

    C                   Reset                   APIErrorDS

    C                   CallP     RLSProfileHdl( 
    C                                            Hdl        :
    C                                            APIErrorDS
    C                                          

    C                   If        BytesAvail <> NoAPIError
    C                   ExSr      ReturnError
    C                   EndIf

    C                   Return    *Off

     *  -------------------------------------------------------------------
     *  - Subroutine.... ReturnError                                      -
     *  - Description... Return error condition to caller                 -
     *  -------------------------------------------------------------------

    C     ReturnError   BegSr

    C                   If        APIErrorPassed
    C                   Eval      APIError = APIErrorDS
    C                   EndIf

    C                   Return    *On

    C                   EndSr

    P VfyUsrPwd       E


回本期目錄
 

檢核使用者密碼程序的使用範例 

File   : QRPGLESRC
Member : VRYUSRPWDT
Type   : RPGLE
Usage  : 此範例程式包含三種呼叫方式,可擇一使用,
        但最好使用有包含錯誤訊息的呼叫方式(方式二及方式三)。
        可在應用程式某些中有需要再次確認密碼時,要求使用者再次輸入密碼,並呼叫
        確認密碼程序  VRYUSRPWD 以檢核使用者密碼輸入正確與否。


     *  ===================================================================
     *  = Program....... VRYUSRPWDT                                       =
     *  = Description... Sample demonstrating use of procedure            =
     *  =                VRYUSRPWD in applications                        =
     *  =                                                                 =
     *  = Compile....... CrtRPGMod Module(YourLib/VRYUSRPWDT)             =
     *  =                          SrcFile(YourLib/YourSrcFile)           =
     *  =                CrtPgm    Pgm(YourLib/VRYUSRPWDT)                =
     *  =                          Module(YourLib/VRYUSRPWDT VRYUSRPWD)   =
     *  =                          ActGrp(*New)                           =
     *  ===================================================================

    D VfyUsrPwd       PR             1N
    D                               10    value
    D                               10    value
    D                              272    Options( *NoPass 

    D UsrPrf          S              8
    D Password        S             10
    D RtnCode         S              1N

    D PSDS           SDS
    D  User                 254    263

    D APIErrorDS      DS
    D  BytesProvided                10I 0 Inz( %Size( APIErrorDS  
    D  BytesAvail                   10I 0 Inz( *Zero 
    D  MsgID                         7    Inz( *Blanks 
    D  Reserved                      1    Inz( X'00' 
    D  MsgDta                      256    Inz( *Blanks 

    C                   Eval      UsrPrf = User

     * call method 1 without API Error Structure
    C                   Eval      RtnCode = VfyUsrPwd(
    C                                                  UsrPrf   :
    C                                                  Password
    C                                                

     * call method 2 with API Error Structure
    C                   Eval      RtnCode = VfyUsrPwd(
    C                                                  UsrPrf     :
    C                                                  Password   :
    C                                                  APIErrorDS
    C                                                

     * call method 3 use procedure
    C                   If        VfyUsrPwd(
    C                                        UsrPrf     :
    C                                        Password   :
    C                                        APIErrorDS
    C                                      

     * Insert error handling code for failed verification

    C                   EndIf

    C                   Eval      *InLr = *On


回本期目錄
 

參考資料 
檢核使用者密碼程序所使用的 API 

1. Get Profile Handle (QSYGETPH)

  This API obtains a profile handle.

  You can find documentation for API QSYGETPH at

  http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/index.htm?info/apis/QSYGETPH.htm

2. Release Profile Handle (QSYRLSPH)

  This API releases a profile handle.

  You can find documentation for API QSYRLSPH at

  http://publib.boulder.ibm.com/pubs/html/as400/v5r1/ic2924/index.htm?info/apis/QSYRLSPH.htm

 pcas400 回复于:2003-07-13 07:46:59
精华

 YeLLoW 回复于:2003-07-14 17:58:56
晕~~~~~~~~~

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网