public class AccountController : Controller
{
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SignIn( string token)
{
try
{
if (token == null ) throw new ArgumentNullException( "token" );
var loginza = new Loginza.Api.LoginzaHelper( Convert .ToInt32( ConfigurationManager .AppSettings[ @"WidgetId" ]), ConfigurationManager .AppSettings[ @"SecureKey" ]) { IsSecureCheck = true };
var authInfo = loginza.AuthInfo(token);
if (authInfo.error_type != null )
throw new AuthException(authInfo.error_message ?? "Unknown error" );
else
{
FormsAuthentication.SetAuthCookie(authInfo.name.full_name, false );
}
return RedirectToAction( "Index" , "Home" , null );
}
catch
{
return View( "Error" );
}
}
}
* This source code was highlighted with Source Code Highlighter .public class AccountController : Controller
{
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SignIn( string token)
{
try
{
if (token == null ) throw new ArgumentNullException( "token" );
var loginza = new Loginza.Api.LoginzaHelper( Convert .ToInt32( ConfigurationManager .AppSettings[ @"WidgetId" ]), ConfigurationManager .AppSettings[ @"SecureKey" ]) { IsSecureCheck = true };
var authInfo = loginza.AuthInfo(token);
if (authInfo.error_type != null )
throw new AuthException(authInfo.error_message ?? "Unknown error" );
else
{
FormsAuthentication.SetAuthCookie(authInfo.name.full_name, false );
}
return RedirectToAction( "Index" , "Home" , null );
}
catch
{
return View( "Error" );
}
}
}
* This source code was highlighted with Source Code Highlighter .Source: https://habr.com/ru/post/117519/
All Articles