1 Reply Latest reply on Jul 13, 2006 4:05 PM by Newsgroup_User

    Remote login through a web service

    Level 7
      Can you set up a login process in a CFC so it can be used remotely through a
      web service? I would like to have my members be able to have their clients
      login to a section of my web site through their own web site.

      Is there anyplace I can find an example of this?

      --
      Wally Kolcz
      Developer / Support


        • 1. Re: Remote login through a web service - Would this work?
          Level 7
          <cfcomponent>
          <cffunction name="CLogin" access="remote" returntype="string">
          <cfargument name="username" type="string" required="true">
          <cfargument name="password" type="string" required="true"
          <cfset
          MM_redirectLoginSuccess=" http://www.softproofs.com/clientarea/index.cfm">
          <cfset MM_redirectLoginFailed="index.cfm?login=failed">
          <cfquery name="MM_rsUser" datasource="#Request.MainDSN#">
          SELECT username,password,priv FROM clients WHERE
          username=#argument.username# AND password=#argument.password#
          </cfquery>
          <cfif MM_rsUser.RecordCount NEQ 0>
          <cftry>
          <cflock scope="Session" timeout="30" type="Exclusive">
          <cfset Session.MM_Username=#argument.username#>
          <cfset Session.MM_UserAuthorization=MM_rsUser.priv[1]>
          </cflock>
          <cfif IsDefined("URL.accessdenied") AND false>
          <cfset MM_redirectLoginSuccess=URL.accessdenied>
          </cfif>
          <cflocation url="#MM_redirectLoginSuccess#" addtoken="no">
          <cfcatch type="Lock">
          <!--- code for handling timeout of cflock --->
          </cfcatch>
          </cftry>
          </cfif>
          <cflocation url="#MM_redirectLoginFailed#" addtoken="no">
          <cfelse>
          <cfset MM_LoginAction=CGI.SCRIPT_NAME>
          <cfif CGI.QUERY_STRING NEQ "">
          <cfset MM_LoginAction=MM_LoginAction & "?" &
          XMLFormat(CGI.QUERY_STRING)>
          </cfif>
          </cfif>
          </cffunction>
          </cfcomponent>