How to compare password in sys_user table ?

vishnu_r
Kilo Explorer

In my script, i'm query'ing the sys_user table with user_name and user_password. this is my query

 

var user_id='username';

var pass='password@123';

 

var target = new GlideRecord('sys_user');

      target.addQuery('user_name', user_id);

    target.addQuery('user_password', pass);

      target.query();    

  while(target.next()){

                  ///code

 

                  }

the password type in sys_user table is password(1 way encryption). how to decrypt this password? i tried using GlideEncrypter(); , but not getting the correct data.. Any help ?

1 ACCEPTED SOLUTION

It was difficult to search and find your thread back to reply  



Not sure if you have found the answer already. if not try below appraoch and see if it works for you ...



Create a scripted web service from where you will authenticate user.. And make your of the below script .. guess it should fit your case .. let me now if it works for you



try


{


      var userName = request.user_name;


      var userPassword = request.user_password;


      var user = GlideUser;


      var authed = user.authenticate(userName,userPassword);


      if(authed)


              {


              response.isValid = 'Valid User';


      }


      else


              {


              response.isValid = 'Invalid User';


      }


}


catch(e)


{


      response.isValid = "Error While Authenticating:"+e;


}



I was able to do it successfully on demo.. So works atleast on demo


View solution in original post

15 REPLIES 15

Hi kalaiarasan,


I'm using a scripted webservice for authenticating user credentials. From a flex application i'm calling this webservice by passing username & password as input parameters. I need to authenticate the user credentials and return a response. Hope you got my requirement .










Hi Vishnu,


You can then set both the username and password as system properties and call these properties while invoking the SOAP call.


Thanks for the reply Subhajit, But how can i set parameters as system properties? I'm working with a scripted webservice..


You can use gs.getProperty('your property here'); to call your Username and Password values.


Haven't done this before .. Will try to setup something on demo ... will let you know ....