@@ -785,35 +785,39 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
785785 return ;
786786 }
787787
788- UIUtils . alert . confirm ( 'CONFIRM.CERTIFY_RULES' , 'CONFIRM.POPUP_SECURITY_WARNING_TITLE' , {
789- cssClass : 'warning' ,
790- okText : 'WOT.BTN_YES_CERTIFY' ,
791- okType : 'button-assertive'
788+ // Certification checklist before confirmation
789+ let answers_are_right = $q . defer ( ) ;
790+ answers_are_right . promise . then ( function ( ) {
791+ UIUtils . loading . show ( ) ;
792+ wallet . certify ( $scope . formData . uid ,
793+ $scope . formData . pubkey ,
794+ $scope . formData . blockUid || ( $scope . formData . requirements && $scope . formData . requirements . meta && $scope . formData . requirements . meta . timestamp ) ,
795+ $scope . formData . requirements && $scope . formData . requirements . meta && $scope . formData . requirements . meta . sig ,
796+ $scope . formData . isMember ,
797+ $scope . formData . wasMember )
798+ . then ( function ( cert ) {
799+ UIUtils . loading . hide ( ) ;
800+ if ( cert ) {
801+ $scope . prepareNewCert ( wallet , cert ) ;
802+ $scope . alreadyCertified = true ;
803+ UIUtils . toast . show ( 'INFO.CERTIFICATION_DONE' ) ;
804+ $scope . formData . received_cert_pending . unshift ( cert ) ;
805+ $scope . formData . requirements . pendingCertificationCount ++ ;
806+ $scope . doMotion ( ) ;
807+ }
808+ } )
809+ . catch ( UIUtils . onError ( 'ERROR.SEND_CERTIFICATION_FAILED' ) ) ;
792810 } )
793- . then ( function ( confirm ) {
794- if ( ! confirm ) {
795- return ;
796- }
797- UIUtils . loading . show ( ) ;
798- wallet . certify ( $scope . formData . uid ,
799- $scope . formData . pubkey ,
800- $scope . formData . blockUid || ( $scope . formData . requirements && $scope . formData . requirements . meta && $scope . formData . requirements . meta . timestamp ) ,
801- $scope . formData . requirements && $scope . formData . requirements . meta && $scope . formData . requirements . meta . sig ,
802- $scope . formData . isMember ,
803- $scope . formData . wasMember )
804- . then ( function ( cert ) {
805- UIUtils . loading . hide ( ) ;
806- if ( cert ) {
807- $scope . prepareNewCert ( wallet , cert ) ;
808- $scope . alreadyCertified = true ;
809- UIUtils . toast . show ( 'INFO.CERTIFICATION_DONE' ) ;
810- $scope . formData . received_cert_pending . unshift ( cert ) ;
811- $scope . formData . requirements . pendingCertificationCount ++ ;
812- $scope . doMotion ( ) ;
813- }
814- } )
815- . catch ( UIUtils . onError ( 'ERROR.SEND_CERTIFICATION_FAILED' ) ) ;
816- } ) ;
811+ . catch (
812+ UIUtils . onError ( 'ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET' )
813+ ) ;
814+
815+ // display certification checklist modal
816+ return Modals . showCertificationCheckList ( {
817+ answers_are_right : answers_are_right ,
818+ identity : $scope . formData ,
819+ } ) ;
820+
817821 } )
818822 . catch ( function ( err ) {
819823 if ( err === 'CANCELLED' ) return ;
@@ -891,36 +895,39 @@ function WotIdentityAbstractController($scope, $rootScope, $state, $translate, $
891895 return ;
892896 }
893897
894- // Ask confirmation
895- $translate ( 'CONFIRM.CERTIFY_RULES_TITLE_UID' , { uid : identity . uid } )
896- . then ( function ( confirmTitle ) {
897- return UIUtils . alert . confirm ( 'CONFIRM.CERTIFY_RULES' , confirmTitle ) ;
898+ // Certification checklist before confirmation
899+ let answers_are_right = $q . defer ( ) ;
900+ answers_are_right . promise . then ( function ( ) {
901+ UIUtils . loading . show ( ) ;
902+ // Send certification
903+ wallet . certify ( identity . uid ,
904+ identity . pubkey ,
905+ identity . blockUid || ( identity . requirements && identity . requirements . meta && identity . requirements . meta . timestamp ) ,
906+ identity . requirements && identity . requirements . meta && identity . requirements . meta . sig ,
907+ identity . isMember ,
908+ identity . wasMember )
909+ . then ( function ( cert ) {
910+ UIUtils . loading . hide ( ) ;
911+ if ( ! cert ) return ;
912+ return csWot . extendAll ( [ cert ] , 'pubkey' )
913+ . then ( function ( ) {
914+ UIUtils . toast . show ( 'INFO.CERTIFICATION_DONE' ) ;
915+ $scope . formData . given_cert_pending . unshift ( cert ) ;
916+ $scope . doMotion ( ) ;
917+ } ) ;
918+ } )
919+ . catch ( UIUtils . onError ( 'ERROR.SEND_CERTIFICATION_FAILED' ) ) ;
898920 } )
899- . then ( function ( confirm ) {
900- if ( ! confirm ) {
901- return ;
902- }
903- UIUtils . loading . show ( ) ;
904-
905- // Send certification
906- wallet . certify ( identity . uid ,
907- identity . pubkey ,
908- identity . blockUid || ( identity . requirements && identity . requirements . meta && identity . requirements . meta . timestamp ) ,
909- identity . requirements && identity . requirements . meta && identity . requirements . meta . sig ,
910- identity . isMember ,
911- identity . wasMember )
912- . then ( function ( cert ) {
913- UIUtils . loading . hide ( ) ;
914- if ( ! cert ) return ;
915- return csWot . extendAll ( [ cert ] , 'pubkey' )
916- . then ( function ( ) {
917- UIUtils . toast . show ( 'INFO.CERTIFICATION_DONE' ) ;
918- $scope . formData . given_cert_pending . unshift ( cert ) ;
919- $scope . doMotion ( ) ;
920- } ) ;
921- } )
922- . catch ( UIUtils . onError ( 'ERROR.SEND_CERTIFICATION_FAILED' ) ) ;
923- } ) ;
921+ . catch (
922+ UIUtils . onError ( 'ACCOUNT.CERTIFICATION_MODAL.CHECKLIST_CONDITIONS_NOT_MET' )
923+ ) ;
924+
925+ // Display cert checklist modal
926+ return Modals . showCertificationCheckList ( {
927+ answers_are_right : answers_are_right ,
928+ identity : identity ,
929+ } ) ;
930+
924931 } )
925932 . catch ( function ( err ) {
926933 if ( err === 'CANCELLED' ) return ;
0 commit comments