Dyrcona

cwmars.change_password

Jun 25th, 2018
241
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE FUNCTION cwmars.change_passwd(userid INT, newpasswd TEXT, passwdtype TEXT DEFAULT 'main')
  2. RETURNS VOID AS $$
  3. DECLARE
  4.     newsalt TEXT;
  5. BEGIN
  6.     SELECT actor.create_salt(passwdtype) INTO newsalt;
  7.     PERFORM actor.set_passwd(userid, passwdtype, md5(newsalt || md5(newpasswd)), newsalt);
  8. END;
  9. $$ LANGUAGE 'plpgsql';
RAW Paste Data